添加10秒超时

This commit is contained in:
lxk0301
2021-03-29 11:56:34 +08:00
parent 3ee2ba84f2
commit c947d7c7cf
2 changed files with 16 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
* @Author: lxk0301 https://gitee.com/lxk0301
* @Date: 2020-08-19 16:12:40
* @Last Modified by: lxk0301
* @Last Modified time: 2021-3-16 9:52:54
* @Last Modified time: 2021-3-29 11:52:54
*/
const querystring = require("querystring");
const $ = new Env();
@@ -165,7 +165,8 @@ function serverNotify(text, desp, timeout = 2100) {
body: `text=${text}&desp=${desp}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
},
timeout: 10000
}
setTimeout(() => {
$.post(options, (err, resp, data) => {
@@ -280,7 +281,8 @@ function BarkNotify(text, desp, params={}) {
url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&${querystring.stringify(params)}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
},
timeout: 10000
}
$.get(options, (err, resp, data) => {
try {
@@ -316,7 +318,8 @@ function tgBotNotify(text, desp) {
body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
},
timeout: 10000
}
if (TG_PROXY_HOST && TG_PROXY_PORT) {
const tunnel = require("tunnel");
@@ -370,7 +373,8 @@ function ddBotNotify(text, desp) {
},
headers: {
'Content-Type': 'application/json'
}
},
timeout: 10000
}
if (DD_BOT_TOKEN && DD_BOT_SECRET) {
const crypto = require('crypto');
@@ -438,6 +442,7 @@ function qywxBotNotify(text, desp) {
headers: {
'Content-Type': 'application/json',
},
timeout: 10000
};
if (QYWX_KEY) {
$.post(options, (err, resp, data) => {
@@ -498,6 +503,7 @@ function qywxamNotify(text, desp) {
headers: {
'Content-Type': 'application/json',
},
timeout: 10000
};
$.post(options_accesstoken, (err, resp, data) => {
html = desp.replace(/\n/g, "<br/>")
@@ -608,7 +614,8 @@ function iGotNotify(text, desp, params={}){
body: `title=${text}&content=${desp}&${querystring.stringify(params)}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
},
timeout: 10000
}
$.post(options, (err, resp, data) => {
try {
@@ -651,7 +658,8 @@ function pushPlusNotify(text, desp) {
body: JSON.stringify(body),
headers: {
'Content-Type': ' application/json'
}
},
timeout: 10000
}
$.post(options, (err, resp, data) => {
try {