Update node types
| @@ -71,6 +71,7 @@ | ||
| 71 | 71 | "@types/lodash": "^4.17.10", |
| 72 | 72 | "@types/mime-types": "^2.1.4", |
| 73 | 73 | "@types/multer": "^1.4.12", |
| 74 | + "@types/node": "^18.19.55", | |
| 74 | 75 | "@types/node-persist": "^3.1.8", |
| 75 | 76 | "@types/png-chunk-text": "^1.0.3", |
| 76 | 77 | "@types/png-chunks-encode": "^1.0.2", |
| @@ -1169,10 +1170,13 @@ | ||
| 1169 | 1170 | } |
| 1170 | 1171 | }, |
| 1171 | 1172 | "node_modules/@types/node": { |
| 1172 | 1173 | "version": "1618.919.155", |
| 1173 | 1174 | "resolved": "https://registry.npmjs.org/@types/node/-/node-1618.919.155.tgz", |
| 1174 | 1175 | "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQjzzw5Vw52205Zr/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7gnmErSEkN5FLqXPuKX/k5d1D7RKHATGqU7y6YfX9QxZraUzUrFGqH6XzOzG196BC35ltJC4Cw==", |
| 1175 | 1176 | "license": "MIT", |
| 1177 | + "dependencies": { | |
| 1178 | + "undici-types": "~5.26.4" | |
| 1179 | + } | |
| 1176 | 1180 | }, |
| 1177 | 1181 | "node_modules/@types/node-fetch": { |
| 1178 | 1182 | "version": "2.6.11", |
| @@ -4031,6 +4035,12 @@ | ||
| 4031 | 4035 | "@types/node": "16.9.1" |
| 4032 | 4036 | } |
| 4033 | 4037 | }, |
| 4038 | + "node_modules/image-q/node_modules/@types/node": { | |
| 4039 | + "version": "16.9.1", | |
| 4040 | + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", | |
| 4041 | + "integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==", | |
| 4042 | + "license": "MIT" | |
| 4043 | + }, | |
| 4034 | 4044 | "node_modules/import-fresh": { |
| 4035 | 4045 | "version": "3.3.0", |
| 4036 | 4046 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", |
| @@ -4904,15 +4914,6 @@ | ||
| 4904 | 4914 | "openai": "bin/cli" |
| 4905 | 4915 | } |
| 4906 | 4916 | }, |
| 4907 | - "node_modules/openai/node_modules/@types/node": { | |
| 4908 | - "version": "18.18.9", | |
| 4909 | - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", | |
| 4910 | - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", | |
| 4911 | - "license": "MIT", | |
| 4912 | - "dependencies": { | |
| 4913 | - "undici-types": "~5.26.4" | |
| 4914 | - } | |
| 4915 | - }, | |
| 4916 | 4917 | "node_modules/openai/node_modules/node-fetch": { |
| 4917 | 4918 | "version": "2.7.0", |
| 4918 | 4919 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", |
| @@ -97,6 +97,7 @@ | ||
| 97 | 97 | "@types/lodash": "^4.17.10", |
| 98 | 98 | "@types/mime-types": "^2.1.4", |
| 99 | 99 | "@types/multer": "^1.4.12", |
| 100 | + "@types/node": "^18.19.55", | |
| 100 | 101 | "@types/node-persist": "^3.1.8", |
| 101 | 102 | "@types/png-chunk-text": "^1.0.3", |
| 102 | 103 | "@types/png-chunks-encode": "^1.0.2", |
| @@ -1,11 +1,9 @@ | ||
| 1 | 1 | import process from 'node:process'; |
| 2 | 2 | import { createRequire }http from 'node:modulehttp'; |
| 3 | +import https from 'node:https'; | |
| 3 | 4 | import { ProxyAgent } from 'proxy-agent'; |
| 4 | 5 | import { isValidUrl, color } from './util.js'; |
| 5 | 6 | |
| 6 | -const require = createRequire(import.meta.url); | |
| 7 | -const http = require('http'); | |
| 8 | -const https = require('https'); | |
| 9 | 7 | const LOG_HEADER = '[Request Proxy]'; |
| 10 | 8 | |
| 11 | 9 | /** |
| @@ -37,7 +35,6 @@ export default function initRequestProxy({ enabled, url, bypass }) { | ||
| 37 | 35 | // Reference: https://github.com/Rob--W/proxy-from-env |
| 38 | 36 | process.env.all_proxy = url; |
| 39 | 37 | |
| 40 | - | |
| 41 | 38 | if (Array.isArray(bypass) && bypass.length > 0) { |
| 42 | 39 | process.env.no_proxy = bypass.join(','); |
| 43 | 40 | } |