fix: use undici ProxyAgent for fetch through VPS

This commit is contained in:
aedes
2026-04-20 18:17:21 +03:00
parent 05e3c927e3
commit 11ebf9fd10

View File

@@ -2,6 +2,13 @@ const express = require('express');
const path = require('path');
const fs = require('fs');
const os = require('os');
const { ProxyAgent, setGlobalDispatcher } = require('undici');
const proxyUrl = process.env.HTTPS_PROXY || process.env.HTTP_PROXY;
if (proxyUrl) {
setGlobalDispatcher(new ProxyAgent(proxyUrl));
console.log(`✓ Using proxy: ${proxyUrl}`);
}
const app = express();
app.use(express.json({ limit: '10mb' }));