From cfc467f8a5eb8ce792b1dac09af17d9e189606a7 Mon Sep 17 00:00:00 2001 From: whyour Date: Mon, 18 Oct 2021 19:18:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtg=E7=B3=BB=E7=BB=9F=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E8=AE=A4=E8=AF=81=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/notify.ts | 3 ++- src/utils/config.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/back/services/notify.ts b/back/services/notify.ts index 92ad8416..de0d81f6 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -127,6 +127,7 @@ export default class NotificationService { telegramBotToken, telegramBotUserId, } = this.params; + const authStr = telegramBotProxyAuth ? `${telegramBotProxyAuth}@` : ''; const url = `https://${ telegramBotApiHost ? telegramBotApiHost : 'api.telegram.org' }/bot${telegramBotToken}/sendMessage`; @@ -137,7 +138,7 @@ export default class NotificationService { keepAliveMsecs: 1000, maxSockets: 256, maxFreeSockets: 256, - proxy: `http://${telegramBotProxyHost}:${telegramBotProxyPort}`, + proxy: `http://${authStr}${telegramBotProxyHost}:${telegramBotProxyPort}`, }; const httpAgent = new HttpProxyAgent(options); const httpsAgent = new HttpsProxyAgent(options); diff --git a/src/utils/config.ts b/src/utils/config.ts index 054cc68c..dde3905f 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -115,7 +115,10 @@ export default { }, { label: 'telegramBotProxyHost', tip: '代理IP' }, { label: 'telegramBotProxyPort', tip: '代理端口' }, - { label: 'telegramBotProxyAuth', tip: 'telegram代理配置认证参数' }, + { + label: 'telegramBotProxyAuth', + tip: 'telegram代理配置认证参数, 用户名与密码用英文冒号连接 user:password', + }, { label: 'telegramBotApiHost', tip: 'telegram api自建的反向代理地址,默认tg官方api',