From 89751b5f3345ee23938b879acb3bcfaee4a0023a Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 9 Dec 2024 17:36:49 -0500 Subject: [PATCH 1/6] refactor options and add pushover-sound-up field --- src/components/notifications/Pushover.vue | 69 +++++++++++++++-------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/src/components/notifications/Pushover.vue b/src/components/notifications/Pushover.vue index 7ee0eafb6..869fba1ed 100644 --- a/src/components/notifications/Pushover.vue +++ b/src/components/notifications/Pushover.vue @@ -16,34 +16,24 @@ - - + + + + + +
*{{ $t("Required") }} @@ -66,5 +56,34 @@ export default { components: { HiddenInput, }, + data() { + return { + soundOptions: [ + "pushover", + "bike", + "bugle", + "cashregister", + "classical", + "cosmic", + "falling", + "gamelan", + "incoming", + "intermission", + "magic", + "mechanical", + "pianobar", + "siren", + "spacealarm", + "tugboat", + "alien", + "climb", + "persistent", + "echo", + "updown", + "vibrate", + "none", + ], + }; + }, }; From 6c8b159174363b9d173cd2033f0bd1f9cf33dc46 Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 9 Dec 2024 17:37:29 -0500 Subject: [PATCH 2/6] 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); } - } } From 12b9d55ef590715e306ec68310fa6f4472611774 Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 9 Dec 2024 17:47:31 -0500 Subject: [PATCH 3/6] remove unused import --- server/notification-providers/pushover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notification-providers/pushover.js b/server/notification-providers/pushover.js index 260b7e3b3..ae43ff4db 100644 --- a/server/notification-providers/pushover.js +++ b/server/notification-providers/pushover.js @@ -1,6 +1,6 @@ const { getMonitorRelativeURL } = require("../../src/util"); const { setting } = require("../util-server"); -const { UP, DOWN } = require("../../src/util"); +const { UP } = require("../../src/util"); const NotificationProvider = require("./notification-provider"); const axios = require("axios"); From ddb98ac1d425f079b1f24af8d4a01a486ea9debd Mon Sep 17 00:00:00 2001 From: seb Date: Mon, 9 Dec 2024 18:01:41 -0500 Subject: [PATCH 4/6] update to keep translations --- src/components/notifications/Pushover.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/notifications/Pushover.vue b/src/components/notifications/Pushover.vue index 869fba1ed..e2fecd29f 100644 --- a/src/components/notifications/Pushover.vue +++ b/src/components/notifications/Pushover.vue @@ -17,14 +17,14 @@ - + - +