mirror of
https://github.com/whyour/qinglong.git
synced 2025-08-24 13:06:10 +08:00
修复 JavaScript telegram 通知
This commit is contained in:
parent
af97543918
commit
f9b9543a6d
|
@ -428,7 +428,7 @@ function tgBotNotify(text, desp) {
|
||||||
TG_PROXY_AUTH,
|
TG_PROXY_AUTH,
|
||||||
} = push_config;
|
} = push_config;
|
||||||
if (TG_BOT_TOKEN && TG_USER_ID) {
|
if (TG_BOT_TOKEN && TG_USER_ID) {
|
||||||
const options = {
|
let options = {
|
||||||
url: `${TG_API_HOST}/bot${TG_BOT_TOKEN}/sendMessage`,
|
url: `${TG_API_HOST}/bot${TG_BOT_TOKEN}/sendMessage`,
|
||||||
json: {
|
json: {
|
||||||
chat_id: `${TG_USER_ID}`,
|
chat_id: `${TG_USER_ID}`,
|
||||||
|
@ -442,20 +442,20 @@ function tgBotNotify(text, desp) {
|
||||||
};
|
};
|
||||||
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
||||||
const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent');
|
const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent');
|
||||||
const options = {
|
const _options = {
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
keepAliveMsecs: 1000,
|
keepAliveMsecs: 1000,
|
||||||
maxSockets: 256,
|
maxSockets: 256,
|
||||||
maxFreeSockets: 256,
|
maxFreeSockets: 256,
|
||||||
proxy: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`,
|
proxy: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`,
|
||||||
};
|
};
|
||||||
const httpAgent = new HttpProxyAgent(options);
|
const httpAgent = new HttpProxyAgent(_options);
|
||||||
const httpsAgent = new HttpsProxyAgent(options);
|
const httpsAgent = new HttpsProxyAgent(_options);
|
||||||
const agent = {
|
const agent = {
|
||||||
http: httpAgent,
|
http: httpAgent,
|
||||||
https: httpsAgent,
|
https: httpsAgent,
|
||||||
};
|
};
|
||||||
Object.assign(options, { agent });
|
options.agent = agent;
|
||||||
}
|
}
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user