From f9b9543a6dae76c74a294d06ab288734e9e1d7b8 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 15 Jan 2025 23:23:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20JavaScript=20telegram=20?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sample/notify.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sample/notify.js b/sample/notify.js index d54fd239..8b9ad821 100644 --- a/sample/notify.js +++ b/sample/notify.js @@ -428,7 +428,7 @@ function tgBotNotify(text, desp) { TG_PROXY_AUTH, } = push_config; if (TG_BOT_TOKEN && TG_USER_ID) { - const options = { + let options = { url: `${TG_API_HOST}/bot${TG_BOT_TOKEN}/sendMessage`, json: { chat_id: `${TG_USER_ID}`, @@ -442,20 +442,20 @@ function tgBotNotify(text, desp) { }; if (TG_PROXY_HOST && TG_PROXY_PORT) { const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent'); - const options = { + const _options = { keepAlive: true, keepAliveMsecs: 1000, maxSockets: 256, maxFreeSockets: 256, proxy: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`, }; - const httpAgent = new HttpProxyAgent(options); - const httpsAgent = new HttpsProxyAgent(options); + const httpAgent = new HttpProxyAgent(_options); + const httpsAgent = new HttpsProxyAgent(_options); const agent = { http: httpAgent, https: httpsAgent, }; - Object.assign(options, { agent }); + options.agent = agent; } $.post(options, (err, resp, data) => { try {