Update server/notification-providers/spugpush.js

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
vapao 2025-05-02 12:21:07 +08:00 committed by GitHub
parent fc8edf0618
commit 9eb55be198
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,7 +16,7 @@ class SpugPush extends NotificationProvider {
"msg": heartbeatJSON["msg"],
"duration": heartbeatJSON["duration"],
"name": monitorJSON["name"],
"target": this.getTarget(monitorJSON),
"target": this.extractAddress(monitorJSON),
});
return okMsg;
@ -25,24 +25,6 @@ class SpugPush extends NotificationProvider {
this.throwGeneralAxiosError(error);
}
}
/**
* Get the formatted target for message
* @param {object} monitorJSON Monitor details (For Up/Down only)
* @returns {string} Formatted target
*/
getTarget(monitorJSON) {
let target = "-";
if (monitorJSON["hostname"]) {
target = monitorJSON["hostname"];
if (monitorJSON["port"]) {
target += ":" + monitorJSON["port"];
}
} else if (monitorJSON["url"]) {
target = monitorJSON["url"];
}
return target;
}
}
module.exports = SpugPush;