From 38c45a3fe3fe35557f8046d268426686595032af Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Fri, 16 Sep 2022 14:21:22 +0800 Subject: [PATCH] Fix previously PR bug about Bark Notification (#2084) Co-authored-by: zuosc --- server/notification-providers/bark.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index 3258e7c52..bcd3c6823 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -28,17 +28,17 @@ class Bark extends NotificationProvider { if (msg != null && heartbeatJSON != null && heartbeatJSON["status"] === UP) { let title = "UptimeKuma Monitor Up"; - return await this.postNotification(title, msg, barkEndpoint); + return await this.postNotification(notification, title, msg, barkEndpoint); } if (msg != null && heartbeatJSON != null && heartbeatJSON["status"] === DOWN) { let title = "UptimeKuma Monitor Down"; - return await this.postNotification(title, msg, barkEndpoint); + return await this.postNotification(notification, title, msg, barkEndpoint); } if (msg != null) { let title = "UptimeKuma Message"; - return await this.postNotification(title, msg, barkEndpoint); + return await this.postNotification(notification, title, msg, barkEndpoint); } } @@ -50,7 +50,7 @@ class Bark extends NotificationProvider { */ appendAdditionalParameters(notification, postUrl) { // set icon to uptime kuma icon, 11kb should be fine - postUrl += "&icon=" + barkNotificationAvatar; + postUrl += "?icon=" + barkNotificationAvatar; // grouping all our notifications if (notification.barkGroup != null) { postUrl += "&group=" + notification.barkGroup; @@ -89,12 +89,12 @@ class Bark extends NotificationProvider { * @param {string} endpoint Endpoint to send request to * @returns {string} */ - async postNotification(title, subtitle, endpoint) { + async postNotification(notification, title, subtitle, endpoint) { // url encode title and subtitle title = encodeURIComponent(title); subtitle = encodeURIComponent(subtitle); let postUrl = endpoint + "/" + title + "/" + subtitle; - postUrl = this.appendAdditionalParameters(postUrl); + postUrl = this.appendAdditionalParameters(notification, postUrl); let result = await axios.get(postUrl); this.checkResult(result); if (result.statusText != null) {