Kuma/server/notification-providers/spugpush.js
vapao 9eb55be198
Update server/notification-providers/spugpush.js
Co-authored-by: Frank Elsinga <frank@elsinga.de>
2025-05-02 12:21:07 +08:00

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;