diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index 092511d87..3258e7c52 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -12,9 +12,7 @@ const { default: axios } = require("axios"); // bark is an APN bridge that sends notifications to Apple devices. -const barkNotificationGroup = "UptimeKuma"; const barkNotificationAvatar = "https://github.com/louislam/uptime-kuma/raw/master/public/icon.png"; -const barkNotificationSound = "telegraph"; const successMessage = "Successes!"; class Bark extends NotificationProvider { @@ -50,13 +48,23 @@ class Bark extends NotificationProvider { * @param {string} postUrl URL to append parameters to * @returns {string} */ - appendAdditionalParameters(postUrl) { - // grouping all our notifications - postUrl += "?group=" + barkNotificationGroup; + appendAdditionalParameters(notification, postUrl) { // set icon to uptime kuma icon, 11kb should be fine postUrl += "&icon=" + barkNotificationAvatar; + // grouping all our notifications + if (notification.barkGroup != null) { + postUrl += "&group=" + notification.barkGroup; + } else { + // default name + postUrl += "&group=" + "UptimeKuma"; + } // picked a sound, this should follow system's mute status when arrival - postUrl += "&sound=" + barkNotificationSound; + if (notification.barkSound != null) { + postUrl += "&sound=" + notification.barkSound; + } else { + // default sound + postUrl += "&sound=" + "telegraph"; + } return postUrl; } diff --git a/src/components/notifications/Bark.vue b/src/components/notifications/Bark.vue index 014450dec..6cac73d36 100644 --- a/src/components/notifications/Bark.vue +++ b/src/components/notifications/Bark.vue @@ -2,9 +2,6 @@
-
-

*{{ $t("Required") }}

-
{{ $t("here") }}
+
+ + +
+
+ + +
diff --git a/src/languages/en.js b/src/languages/en.js index 2232ea5fc..b99516124 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -408,6 +408,8 @@ export default { SignName: "SignName", "Sms template must contain parameters: ": "Sms template must contain parameters: ", "Bark Endpoint": "Bark Endpoint", + "Bark Group": "Bark Group", + "Bark Sound": "Bark Sound", WebHookUrl: "WebHookUrl", SecretKey: "SecretKey", "For safety, must use secret key": "For safety, must use secret key", diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js index 67077f389..8dbe05f0f 100644 --- a/src/languages/zh-CN.js +++ b/src/languages/zh-CN.js @@ -404,6 +404,8 @@ export default { TemplateCode: "TemplateCode", SignName: "SignName", "Bark Endpoint": "Bark 接入点", + "Bark Group": "Bark 群组", + "Bark Sound": "Bark 铃声", "Device Token": "Apple Device Token", Platform: "平台", iOS: "iOS", diff --git a/src/languages/zh-TW.js b/src/languages/zh-TW.js index be87c540a..3405c02ab 100644 --- a/src/languages/zh-TW.js +++ b/src/languages/zh-TW.js @@ -408,6 +408,8 @@ export default { SignName: "SignName", "Sms template must contain parameters: ": "Sms 範本必須包含參數:", "Bark Endpoint": "Bark 端點", + "Bark Group": "Bark 群組", + "Bark Sound": "Bark 鈴聲", WebHookUrl: "WebHookUrl", SecretKey: "SecretKey", "For safety, must use secret key": "為了安全起見,必須使用秘密金鑰",