Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
|
@@ -47,7 +47,7 @@ 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 |
|
|
@@ -72,6 +72,12 @@ const DEFAULT_HEADERS = {
|
|
| 72 |
|
| 73 |
|
| 74 |
async function initialization() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
if (CONFIG.API.IS_CUSTOM_SSO) {
|
| 76 |
if(CONFIG.API.IS_TEMP_GROK2){
|
| 77 |
await tempCookieManager.ensureCookies();
|
|
|
|
| 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: null
|
| 51 |
};
|
| 52 |
puppeteer.use(StealthPlugin())
|
| 53 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
async function initialization() {
|
| 75 |
+
try {
|
| 76 |
+
CONFIG.CHROME_PATH = puppeteer.executablePath();
|
| 77 |
+
} catch (error) {
|
| 78 |
+
CONFIG.CHROME_PATH = "/usr/bin/chromium";
|
| 79 |
+
}
|
| 80 |
+
Logger.info(`CHROME_PATH: ${CONFIG.CHROME_PATH}`, 'Server');
|
| 81 |
if (CONFIG.API.IS_CUSTOM_SSO) {
|
| 82 |
if(CONFIG.API.IS_TEMP_GROK2){
|
| 83 |
await tempCookieManager.ensureCookies();
|