add logic to select sound for UP vs DOWN events

This commit is contained in:
seb 2024-12-09 17:37:29 -05:00
parent 89751b5f33
commit 6c8b159174

View file

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