mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-17 05:47:11 +00:00
fix: 兼容5和7的proxy依赖
This commit is contained in:
parent
5e7d73908f
commit
f620e10abb
8 changed files with 727 additions and 334 deletions
17
utils/proxy.js
Normal file
17
utils/proxy.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// workaround for ver 7.x and ver 5.x
|
||||
import HttpsProxyAgent from 'https-proxy-agent'
|
||||
|
||||
let proxy = HttpsProxyAgent
|
||||
if (typeof proxy !== 'function') {
|
||||
proxy = (p) => {
|
||||
return new HttpsProxyAgent.HttpsProxyAgent(p)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return a proxy function
|
||||
* @returns {*|createHttpsProxyAgent|((opts: (string | createHttpsProxyAgent.HttpsProxyAgentOptions)) => HttpsProxyAgent)}
|
||||
*/
|
||||
export function getProxy () {
|
||||
return proxy
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue