mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
golaert req fix and axios update for formdata
This commit is contained in:
parent
d44663c57c
commit
82dd9a7c16
3 changed files with 102 additions and 16621 deletions
16694
package-lock.json
generated
16694
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -63,7 +63,7 @@
|
|||
"dependencies": {
|
||||
"@louislam/sqlite3": "~15.0.6",
|
||||
"args-parser": "~1.3.0",
|
||||
"axios": "~0.26.1",
|
||||
"axios": "~0.27.0",
|
||||
"axios-ntlm": "^1.3.0",
|
||||
"badge-maker": "^3.3.1",
|
||||
"bcryptjs": "~2.4.3",
|
||||
|
|
|
@ -8,23 +8,26 @@ class GoAlert extends NotificationProvider {
|
|||
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
let okMsg = "Sent Successfully.";
|
||||
let closeAction = "close";
|
||||
let parameters = {
|
||||
token: notification.goAlertToken,
|
||||
summary: msg,
|
||||
};
|
||||
// if (heartbeatJSON["status"] === UP) {
|
||||
// parameters["action"] = closeAction;
|
||||
// }
|
||||
try {
|
||||
await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming`, {
|
||||
params: parameters,
|
||||
});
|
||||
let closeAction = "close";
|
||||
let data = {
|
||||
summary: msg,
|
||||
};
|
||||
if (heartbeatJSON != null && heartbeatJSON["status"] === UP) {
|
||||
data["action"] = closeAction;
|
||||
}
|
||||
let headers = {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
};
|
||||
let config = {
|
||||
headers: headers
|
||||
};
|
||||
let resp = await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config);
|
||||
console.log(resp);
|
||||
return okMsg;
|
||||
|
||||
} catch (error) {
|
||||
let msg = (error.response.data) ? error.response.data : "Error without response";
|
||||
console.log(error)
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue