mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 07:37:39 +00:00
feat(proxy): fallback to a global proxy list (#1388)
This commit is contained in:
+15
-5
@@ -147,6 +147,14 @@ function envOrNumberMax(
|
||||
return number ?? 0;
|
||||
}
|
||||
|
||||
function loadProxyList(filename: string) {
|
||||
return readFileSync(`${filename}.proxies`)
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((x) => x.trim());
|
||||
}
|
||||
|
||||
const browser = {
|
||||
isHeadless: envOrBoolean(process.env.HEADLESS),
|
||||
isIncognito: envOrBoolean(process.env.INCOGNITO, false),
|
||||
@@ -384,13 +392,15 @@ const store = {
|
||||
|
||||
let proxyList;
|
||||
try {
|
||||
proxyList = readFileSync(`${name}.proxies`)
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((x) => x.trim());
|
||||
proxyList = loadProxyList(name);
|
||||
} catch {}
|
||||
|
||||
if (!proxyList) {
|
||||
try {
|
||||
proxyList = loadProxyList('global');
|
||||
} catch {}
|
||||
}
|
||||
|
||||
return {
|
||||
maxPageSleep: envOrNumberMax(
|
||||
minPageSleep,
|
||||
|
||||
Reference in New Issue
Block a user