diff --git a/server/notification-providers/lunasea.js b/server/notification-providers/lunasea.js index 2985425e..4d7136f7 100644 --- a/server/notification-providers/lunasea.js +++ b/server/notification-providers/lunasea.js @@ -8,7 +8,12 @@ class LunaSea extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; - let lunaseadevice = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice; + let lunaseaurl = ""; + if (notification.lunaseaTarget === "user") { + lunaseaurl = "https://notify.lunasea.app/v1/custom/user/" + notification.lunaseaUserID; + } else { + lunaseaurl = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice; + } try { if (heartbeatJSON == null) { @@ -16,7 +21,7 @@ class LunaSea extends NotificationProvider { "title": "Uptime Kuma Alert", "body": msg, }; - await axios.post(lunaseadevice, testdata); + await axios.post(lunaseaurl, testdata); return okMsg; } @@ -25,7 +30,7 @@ class LunaSea extends NotificationProvider { "title": "UptimeKuma Alert: " + monitorJSON["name"], "body": "[🔴 Down] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"], }; - await axios.post(lunaseadevice, downdata); + await axios.post(lunaseaurl, downdata); return okMsg; } @@ -34,7 +39,7 @@ class LunaSea extends NotificationProvider { "title": "UptimeKuma Alert: " + monitorJSON["name"], "body": "[✅ Up] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"], }; - await axios.post(lunaseadevice, updata); + await axios.post(lunaseaurl, updata); return okMsg; } diff --git a/src/components/notifications/LunaSea.vue b/src/components/notifications/LunaSea.vue index 34a98688..1ee4a8a5 100644 --- a/src/components/notifications/LunaSea.vue +++ b/src/components/notifications/LunaSea.vue @@ -1,9 +1,33 @@ + +