From 6c8b159174363b9d173cd2033f0bd1f9cf33dc46 Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 9 Dec 2024 17:37:29 -0500 Subject: [PATCH] add logic to select sound for UP vs DOWN events --- server/notification-providers/pushover.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/server/notification-providers/pushover.js b/server/notification-providers/pushover.js index 8422b64c2..260b7e3b3 100644 --- a/server/notification-providers/pushover.js +++ b/server/notification-providers/pushover.js @@ -1,5 +1,6 @@ const { getMonitorRelativeURL } = require("../../src/util"); const { setting } = require("../util-server"); +const { UP, DOWN } = require("../../src/util"); const NotificationProvider = require("./notification-provider"); const axios = require("axios"); @@ -43,15 +44,19 @@ class Pushover extends NotificationProvider { if (heartbeatJSON == null) { await axios.post(url, data); return okMsg; - } else { - data.message += `\nTime (${heartbeatJSON["timezone"]}):${heartbeatJSON["localDateTime"]}`; - await axios.post(url, data); - return okMsg; } + + if (heartbeatJSON.status === UP) { + data.sound = notification.pushoversounds_up; + } + + data.message += `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`; + await axios.post(url, data); + return okMsg; + } catch (error) { this.throwGeneralAxiosError(error); } - } }