Spaces:
Runtime error
Runtime error
Update index.js
Browse files
index.js
CHANGED
@@ -47,9 +47,10 @@ const CONFIG = {
|
|
47 |
SSO_INDEX: 0,//sso的索引
|
48 |
TEMP_COOKIE_INDEX: 0,//临时cookie的下标
|
49 |
ISSHOW_SEARCH_RESULTS: process.env.ISSHOW_SEARCH_RESULTS == undefined ? true : process.env.ISSHOW_SEARCH_RESULTS == 'true',//是否显示搜索结果
|
50 |
-
CHROME_PATH:
|
51 |
};
|
52 |
puppeteer.use(StealthPlugin())
|
|
|
53 |
// 请求头配置
|
54 |
const DEFAULT_HEADERS = {
|
55 |
'accept': '*/*',
|
@@ -307,7 +308,6 @@ class GrokTempCookieManager {
|
|
307 |
}
|
308 |
async initializeTempCookies(count = 1) {
|
309 |
Logger.info(`初始化 ${count} 个认证信息`, 'Server');
|
310 |
-
const executablePath = puppeteer.executablePath();
|
311 |
const browserOptions = {
|
312 |
headless: true,
|
313 |
args: [
|
@@ -316,7 +316,7 @@ class GrokTempCookieManager {
|
|
316 |
'--disable-dev-shm-usage',
|
317 |
'--disable-gpu'
|
318 |
],
|
319 |
-
executablePath:
|
320 |
};
|
321 |
|
322 |
const browsers = await Promise.all(
|
|
|
47 |
SSO_INDEX: 0,//sso的索引
|
48 |
TEMP_COOKIE_INDEX: 0,//临时cookie的下标
|
49 |
ISSHOW_SEARCH_RESULTS: process.env.ISSHOW_SEARCH_RESULTS == undefined ? true : process.env.ISSHOW_SEARCH_RESULTS == 'true',//是否显示搜索结果
|
50 |
+
CHROME_PATH: puppeteer.executablePath() || "/usr/bin/chromium"//chrome路径
|
51 |
};
|
52 |
puppeteer.use(StealthPlugin())
|
53 |
+
|
54 |
// 请求头配置
|
55 |
const DEFAULT_HEADERS = {
|
56 |
'accept': '*/*',
|
|
|
308 |
}
|
309 |
async initializeTempCookies(count = 1) {
|
310 |
Logger.info(`初始化 ${count} 个认证信息`, 'Server');
|
|
|
311 |
const browserOptions = {
|
312 |
headless: true,
|
313 |
args: [
|
|
|
316 |
'--disable-dev-shm-usage',
|
317 |
'--disable-gpu'
|
318 |
],
|
319 |
+
executablePath: CONFIG.CHROME_PATH
|
320 |
};
|
321 |
|
322 |
const browsers = await Promise.all(
|