mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 12:21:31 +08:00
feat(core): support proxy config for pupperteer (#10714)
* feat: support proxy config for pupperteer * test: add puppeteer proxy detection * fix: package.json * test: fix regex
This commit is contained in:
@@ -73,11 +73,17 @@ const requestWrapper = (url, options) => {
|
||||
if (agent && new RegExp(config.proxy.url_regex).test(url)) {
|
||||
let agentResult;
|
||||
try {
|
||||
agentResult = agent[(options.protocol || url.match(/(https?:)/)[1]).slice(0, -1)];
|
||||
agentResult = agent[(options.protocol || url.match(/(^https?:)/)[1]).slice(0, -1)];
|
||||
} catch (error) {
|
||||
agentResult = null;
|
||||
}
|
||||
options.agent = agentResult;
|
||||
try {
|
||||
if (new URL(url).host !== new URL(config.proxyUri).host) {
|
||||
options.agent = agentResult;
|
||||
}
|
||||
} catch (error) {
|
||||
options.agent = agentResult;
|
||||
}
|
||||
|
||||
if (config.proxy.auth) {
|
||||
if (!options.headers) {
|
||||
|
||||
Reference in New Issue
Block a user