mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-01 11:22:34 +02:00
30 lines
846 B
JavaScript
30 lines
846 B
JavaScript
const NotificationProvider = require("./notification-provider");
|
|
const axios = require("axios");
|
|
|
|
class SpugPush extends NotificationProvider {
|
|
|
|
name = "SpugPush";
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
|
let okMsg = "Sent Successfully.";
|
|
try {
|
|
await axios.post(`https://push.spug.cc/send/${notification.templateKey}`, {
|
|
"status": heartbeatJSON["status"],
|
|
"msg": heartbeatJSON["msg"],
|
|
"duration": heartbeatJSON["duration"],
|
|
"name": monitorJSON["name"],
|
|
"target": this.extractAddress(monitorJSON),
|
|
});
|
|
|
|
return okMsg;
|
|
|
|
} catch (error) {
|
|
this.throwGeneralAxiosError(error);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = SpugPush;
|