From 6984596568d519651d31e6c4daae179b0a32d693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=80=A0xu=5Fzh?= Date: Fri, 21 Jul 2023 22:01:20 +0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Frank Elsinga --- server/notification-providers/pushdeer.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/server/notification-providers/pushdeer.js b/server/notification-providers/pushdeer.js index 17139174f..cba3fce2f 100644 --- a/server/notification-providers/pushdeer.js +++ b/server/notification-providers/pushdeer.js @@ -8,16 +8,9 @@ class PushDeer extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; - let defaultServer = "https://api2.pushdeer.com"; let endpoint = "/message/push"; - let pushdeerlink; - if (notification.pushdeerServer) { - // remove blank characters and ending '/' - let customServer = notification.pushdeerServer.trim().replace(/\/*$/, ""); - pushdeerlink = `${customServer}${endpoint}`; - } else { - pushdeerlink = `${defaultServer}${endpoint}`; - } + let serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com"; + pushdeerlink = `${serverUrl.trim().replace(/\/*$/, "")}${endpoint}`; let valid = msg != null && monitorJSON != null && heartbeatJSON != null;