From ce2d78f45ac1db458632747e3a461b56cd6be0a2 Mon Sep 17 00:00:00 2001 From: Niyas Date: Sat, 17 Jul 2021 17:55:02 +0530 Subject: [PATCH] Pushover support --- server/notification.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/server/notification.js b/server/notification.js index 99cc1568c..6a92effe8 100644 --- a/server/notification.js +++ b/server/notification.js @@ -177,6 +177,35 @@ class Notification { return false; } + } else if (notification.type === "pushover") { + var pushoverlink = 'https://api.pushover.net/1/messages.json' + try { + if (heartbeatJSON == null) { + let data = {'message': "Uptime Kuma Pushover testing successful.", + 'user': notification.pushoveruserkey, 'token': notification.pushoverapptoken, 'sound':notification.pushoversounds, + 'priority': notification.pushoverpriority, 'title':notification.pushovertitle, 'retry': "30", 'expire':"3600", 'html': 1} + let res = await axios.post(pushoverlink, data) + return true; + } + + let data = { + "message": "Uptime Kuma Alert\n\nMessage:" +msg + '\nTime (UTC):' +time, + "user":notification.pushoveruserkey, + "token": notification.pushoverapptoken, + "sound": notification.pushoversounds, + "priority": notification.pushoverpriority, + "title": notification.pushovertitle, + "retry": "30", + "expire": "3600", + "html": 1 + } + let res = await axios.post(pushoverlink, data) + return true; + } catch (error) { + console.log(error) + return false; + } + } else { throw new Error("Notification type is not supported") }