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
|
|
@ -6,11 +6,11 @@ import fetch, {
|
|||
} from 'node-fetch'
|
||||
import crypto from 'crypto'
|
||||
import WebSocket from 'ws'
|
||||
import HttpsProxyAgent from 'https-proxy-agent'
|
||||
import { Config, pureSydneyInstruction } from './config.js'
|
||||
import { formatDate, getMasterQQ, isCN, getUserData } from './common.js'
|
||||
import delay from 'delay'
|
||||
import moment from 'moment'
|
||||
import { getProxy } from './proxy.js'
|
||||
|
||||
if (!globalThis.fetch) {
|
||||
globalThis.fetch = fetch
|
||||
|
|
@ -19,12 +19,7 @@ if (!globalThis.fetch) {
|
|||
globalThis.Response = Response
|
||||
}
|
||||
// workaround for ver 7.x and ver 5.x
|
||||
let proxy = HttpsProxyAgent
|
||||
if (typeof proxy !== 'function') {
|
||||
proxy = (p) => {
|
||||
return new HttpsProxyAgent.HttpsProxyAgent(p)
|
||||
}
|
||||
}
|
||||
let proxy = getProxy()
|
||||
|
||||
async function getKeyv () {
|
||||
let Keyv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue