Feature(pptr): 让 Puppeteer 尊重 Koishi 全局代理设置
Closed this issue · 6 comments
目前 pptr 是没有跟随 Koishi 全局代理的设置:
koishi-plugin-puppeteer/packages/core/src/index.ts
Lines 58 to 61 in a93fcda
希望尊重 Koishi 全局代理设置(
想的一个笨笨方法:
//add proxyAgent
if(ctx.root.config.request.proxyAgent){
this.config.args.push([`--proxy-server=${ctx.root.config.request.proxyAgent}`])
}
this.browser = await puppeteer.launch({
...this.config,
executablePath,
})
A possible way to specify the global proxy for Chrome was by environment variables, but I am not very sure if that is implementable with puppeteer.
这个做法应该就是最好的
所以目前来说添加启动选项是比较好的实践吗,梦梦怎么看
这个 proxy-server 支持 socks 吗?
这个 proxy-server 支持 socks 吗?
看了下,支持的:
To configure chrome to proxy traffic through the SOCKS v5 proxy server myproxy:8080, launch chrome with these two command-line flags:
--proxy-server="socks5://myproxy:8080"
--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE myproxy"
详见:https://www.chromium.org/developers/design-documents/network-stack/socks-proxy/
那确实可以从 http.config 里读取。我来改吧