mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 02:57:34 +00:00
feat: add proxy rotation (settable per store) (#1026)
This commit is contained in:
+13
-1
@@ -2,6 +2,7 @@ import {banner} from './banner';
|
||||
|
||||
import {config as config_} from 'dotenv';
|
||||
import path from 'path';
|
||||
import {readFileSync} from 'fs';
|
||||
|
||||
config_({path: path.resolve(__dirname, '../.env')});
|
||||
|
||||
@@ -354,6 +355,16 @@ const store = {
|
||||
]),
|
||||
stores: envOrArray(process.env.STORES, ['nvidia']).map((entry) => {
|
||||
const [name, minPageSleep, maxPageSleep] = entry.match(/[^:]+/g) ?? [];
|
||||
|
||||
let proxyList;
|
||||
try {
|
||||
proxyList = readFileSync(`${name}.proxies`)
|
||||
.toString()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map((x) => x.trim());
|
||||
} catch {}
|
||||
|
||||
return {
|
||||
maxPageSleep: envOrNumberMax(
|
||||
minPageSleep,
|
||||
@@ -365,7 +376,8 @@ const store = {
|
||||
maxPageSleep,
|
||||
browser.minSleep
|
||||
),
|
||||
name: envOrString(name)
|
||||
name: envOrString(name),
|
||||
proxyList
|
||||
};
|
||||
})
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user