From d7e12dc92dfd24eae2cc37a41d0bfa88d47fc304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=80=A0xu=5Fzh?= Date: Thu, 20 Jul 2023 09:06:37 +0000 Subject: [PATCH] feat: allow the user to configure PushDeer Server URL --- server/notification-providers/pushdeer.js | 9 ++++++++- src/components/notifications/PushDeer.vue | 5 +++++ src/lang/en.json | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/server/notification-providers/pushdeer.js b/server/notification-providers/pushdeer.js index bbd83f4bf..ff3fd7d9b 100644 --- a/server/notification-providers/pushdeer.js +++ b/server/notification-providers/pushdeer.js @@ -8,7 +8,14 @@ class PushDeer extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; - let pushdeerlink = "https://api2.pushdeer.com/message/push"; + let defaultServer = "https://api2.pushdeer.com"; + let endpoint = "/message/push"; + let pushdeerlink; + if (notification.pushdeerServer) { + pushdeerlink = `${notification.pushdeerServer}${endpoint}`; + } else { + pushdeerlink = `${defaultServer}${endpoint}`; + } let valid = msg != null && monitorJSON != null && heartbeatJSON != null; diff --git a/src/components/notifications/PushDeer.vue b/src/components/notifications/PushDeer.vue index f61849630..40970f15a 100644 --- a/src/components/notifications/PushDeer.vue +++ b/src/components/notifications/PushDeer.vue @@ -1,4 +1,9 @@