添加10秒超时
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* @Author: lxk0301 https://gitee.com/lxk0301
|
* @Author: lxk0301 https://gitee.com/lxk0301
|
||||||
* @Date: 2020-08-19 16:12:40
|
* @Date: 2020-08-19 16:12:40
|
||||||
* @Last Modified by: lxk0301
|
* @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 querystring = require("querystring");
|
||||||
const $ = new Env();
|
const $ = new Env();
|
||||||
@@ -165,7 +165,8 @@ function serverNotify(text, desp, timeout = 2100) {
|
|||||||
body: `text=${text}&desp=${desp}`,
|
body: `text=${text}&desp=${desp}`,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
},
|
||||||
|
timeout: 10000
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$.post(options, (err, resp, data) => {
|
$.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)}`,
|
url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&${querystring.stringify(params)}`,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
},
|
||||||
|
timeout: 10000
|
||||||
}
|
}
|
||||||
$.get(options, (err, resp, data) => {
|
$.get(options, (err, resp, data) => {
|
||||||
try {
|
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`,
|
body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true`,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
},
|
||||||
|
timeout: 10000
|
||||||
}
|
}
|
||||||
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
||||||
const tunnel = require("tunnel");
|
const tunnel = require("tunnel");
|
||||||
@@ -370,7 +373,8 @@ function ddBotNotify(text, desp) {
|
|||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
},
|
||||||
|
timeout: 10000
|
||||||
}
|
}
|
||||||
if (DD_BOT_TOKEN && DD_BOT_SECRET) {
|
if (DD_BOT_TOKEN && DD_BOT_SECRET) {
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
@@ -438,6 +442,7 @@ function qywxBotNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
timeout: 10000
|
||||||
};
|
};
|
||||||
if (QYWX_KEY) {
|
if (QYWX_KEY) {
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
@@ -498,6 +503,7 @@ function qywxamNotify(text, desp) {
|
|||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
|
timeout: 10000
|
||||||
};
|
};
|
||||||
$.post(options_accesstoken, (err, resp, data) => {
|
$.post(options_accesstoken, (err, resp, data) => {
|
||||||
html = desp.replace(/\n/g, "<br/>")
|
html = desp.replace(/\n/g, "<br/>")
|
||||||
@@ -608,7 +614,8 @@ function iGotNotify(text, desp, params={}){
|
|||||||
body: `title=${text}&content=${desp}&${querystring.stringify(params)}`,
|
body: `title=${text}&content=${desp}&${querystring.stringify(params)}`,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
'Content-Type': 'application/x-www-form-urlencoded'
|
||||||
}
|
},
|
||||||
|
timeout: 10000
|
||||||
}
|
}
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
@@ -651,7 +658,8 @@ function pushPlusNotify(text, desp) {
|
|||||||
body: JSON.stringify(body),
|
body: JSON.stringify(body),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': ' application/json'
|
'Content-Type': ' application/json'
|
||||||
}
|
},
|
||||||
|
timeout: 10000
|
||||||
}
|
}
|
||||||
$.post(options, (err, resp, data) => {
|
$.post(options, (err, resp, data) => {
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user