Update SpugPush notification payload (#5816)

This commit is contained in:
vapao 2025-05-04 20:42:40 +08:00 committed by GitHub
parent 6a5011ad34
commit 32d92eccfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,19 +13,19 @@ class SpugPush extends NotificationProvider {
let okMsg = "Sent Successfully."; let okMsg = "Sent Successfully.";
try { try {
let formData = { let formData = {
msg title: "Uptime Kuma Message",
content: msg
}; };
const apiUrl = `https://push.spug.cc/send/${notification.templateKey}`; if (heartbeatJSON) {
if (heartbeatJSON == null) { if (heartbeatJSON["status"] === UP) {
formData.title = "Uptime Kuma Message";
} else if (heartbeatJSON["status"] === UP) {
formData.title = `UptimeKuma 「${monitorJSON["name"]}」 is Up`; formData.title = `UptimeKuma 「${monitorJSON["name"]}」 is Up`;
formData.msg = `[✅ Up] ${heartbeatJSON["msg"]}`; formData.content = `[✅ Up] ${heartbeatJSON["msg"]}`;
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
formData.title = `UptimeKuma 「${monitorJSON["name"]}」 is Down`; formData.title = `UptimeKuma 「${monitorJSON["name"]}」 is Down`;
formData.msg = `[🔴 Down] ${heartbeatJSON["msg"]}`; formData.content = `[🔴 Down] ${heartbeatJSON["msg"]}`;
} }
}
const apiUrl = `https://push.spug.cc/send/${notification.templateKey}`;
await axios.post(apiUrl, formData); await axios.post(apiUrl, formData);
return okMsg; return okMsg;
} catch (error) { } catch (error) {