mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 15:47:35 +00:00
fix(proxy): fix requests with proxies (#1408)
This commit is contained in:
+9
-3
@@ -14,7 +14,8 @@ import {
|
||||
delay,
|
||||
getRandomUserAgent,
|
||||
getSleepTime,
|
||||
isStatusCodeInRange
|
||||
isStatusCodeInRange,
|
||||
noop
|
||||
} from '../util';
|
||||
import {disableBlockerInPage, enableBlockerInPage} from '../adblocker';
|
||||
import {config} from '../config';
|
||||
@@ -23,7 +24,7 @@ import {filterStoreLink} from './filter';
|
||||
import open from 'open';
|
||||
import {processBackoffDelay} from './model/helpers/backoff';
|
||||
import {sendNotification} from '../notification';
|
||||
import useProxy from 'puppeteer-page-proxy';
|
||||
import useProxy from '@doridian/puppeteer-page-proxy';
|
||||
|
||||
const inStock: Record<string, boolean> = {};
|
||||
|
||||
@@ -75,7 +76,7 @@ async function handleProxy(request: Request, proxy?: string) {
|
||||
try {
|
||||
await useProxy(request, proxy);
|
||||
} catch (error: unknown) {
|
||||
logger.error(error);
|
||||
logger.error('handleProxy', error);
|
||||
try {
|
||||
await request.abort();
|
||||
} catch {}
|
||||
@@ -203,6 +204,11 @@ async function lookup(browser: Browser, store: Store) {
|
||||
return onProxyFunc;
|
||||
}
|
||||
|
||||
// Give dummy setRequestInterception to avoid AdBlock from messing with it
|
||||
if (prop === 'setRequestInterception') {
|
||||
return noop;
|
||||
}
|
||||
|
||||
return Reflect.get(target, prop, receiver);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user