Pushover add UP/DOWN status sounds (#5426)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
Co-authored-by: Moqavem <sina.farahabadi@gmail.com>
This commit is contained in:
Ruse
2025-04-26 17:01:21 -04:00
committed by GitHub
parent 33f253f825
commit 27f808448f
2 changed files with 55 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
const { getMonitorRelativeURL } = require("../../src/util");
const { setting } = require("../util-server");
const { UP } = require("../../src/util");
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
@@ -43,15 +44,20 @@ class Pushover extends NotificationProvider {
if (heartbeatJSON == null) {
await axios.post(url, data);
return okMsg;
} else {
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>:${heartbeatJSON["localDateTime"]}`;
await axios.post(url, data);
return okMsg;
}
if (heartbeatJSON.status === UP && notification.pushoversounds_up) {
// default = DOWN => DOWN-sound is also played for non-UP/DOWN notiifcations
data.sound = notification.pushoversounds_up;
}
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>: ${heartbeatJSON["localDateTime"]}`;
await axios.post(url, data);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}