From 817c941489efabe35ac08ed6a6e9158e424617fe Mon Sep 17 00:00:00 2001
From: Super Manito <68613938+SuperManito@users.noreply.github.com>
Date: Sun, 12 Jun 2022 22:30:42 +0800
Subject: [PATCH] Add Bark Notification Parameters
---
server/notification-providers/bark.js | 15 +++-
src/components/notifications/Bark.vue | 106 ++++++++++++++++++++++++++
src/languages/bg-BG.js | 2 +
src/languages/de-DE.js | 2 +
src/languages/en.js | 2 +
src/languages/ko-KR.js | 2 +
src/languages/nl-NL.js | 2 +
src/languages/pl.js | 2 +
src/languages/th-TH.js | 2 +
src/languages/tr-TR.js | 2 +
src/languages/vi-VN.js | 2 +
src/languages/zh-CN.js | 2 +
src/languages/zh-TW.js | 2 +
13 files changed, 140 insertions(+), 3 deletions(-)
diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js
index 092511d87..a2c4966a2 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 {
@@ -53,10 +51,21 @@ class Bark extends NotificationProvider {
appendAdditionalParameters(postUrl) {
// grouping all our notifications
postUrl += "?group=" + barkNotificationGroup;
+ if (notification.barkGroup != null) {
+ postUrl += "&group=" + notification.barkGroup;
+ } else {
+ postUrl += "&group=" + "UptimeKuma";
+ // default group
+ }
// set icon to uptime kuma icon, 11kb should be fine
postUrl += "&icon=" + barkNotificationAvatar;
// picked a sound, this should follow system's mute status when arrival
- postUrl += "&sound=" + barkNotificationSound;
+ if (notification.barkSound != null) {
+ postUrl += "&sound=" + notification.barkSound;
+ } else {
+ postUrl += "&sound=" + "telegraph";
+ // default sound
+ }
return postUrl;
}
diff --git a/src/components/notifications/Bark.vue b/src/components/notifications/Bark.vue
index 014450dec..70e4322d3 100644
--- a/src/components/notifications/Bark.vue
+++ b/src/components/notifications/Bark.vue
@@ -12,4 +12,110 @@
>{{ $t("here") }}
+
+
+
+
+
+
+
+
+
diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js
index 6297062ae..23b1b7264 100644
--- a/src/languages/bg-BG.js
+++ b/src/languages/bg-BG.js
@@ -389,6 +389,8 @@ export default {
SignName: "Знак име",
"Sms template must contain parameters: ": "SMS шаблонът трябва да съдържа следните параметри: ",
"Bark Endpoint": "Bark крайна точка",
+ "Bark Group": "Bark група",
+ "Bark Sound": "Bark Звънене",
WebHookUrl: "URL адрес на уеб кука",
SecretKey: "Таен ключ",
"For safety, must use secret key": "За сигурност, трябва да се използва таен ключ",
diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js
index e679937cf..aeba230f8 100644
--- a/src/languages/de-DE.js
+++ b/src/languages/de-DE.js
@@ -389,6 +389,8 @@ export default {
SignName: "Signaturname",
"Sms template must contain parameters: ": "SMS Vorlage muss folgende Parameter enthalten: ",
"Bark Endpoint": "Bark Endpunkt",
+ "Bark Group": "Bark Gruppe",
+ "Bark Sound": "Bark Klingelton",
WebHookUrl: "Webhook URL",
SecretKey: "Geheimer Schlüssel",
"For safety, must use secret key": "Zur Sicherheit muss ein geheimer Schlüssel verwendet werden",
diff --git a/src/languages/en.js b/src/languages/en.js
index aa6737dd8..4b8f782fe 100644
--- a/src/languages/en.js
+++ b/src/languages/en.js
@@ -406,6 +406,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/ko-KR.js b/src/languages/ko-KR.js
index da034167d..0ed7a6f2e 100644
--- a/src/languages/ko-KR.js
+++ b/src/languages/ko-KR.js
@@ -406,6 +406,8 @@ export default {
SignName: "SignName",
"Sms template must contain parameters: ": "Sms 템플릿은 다음과 같은 파라미터가 포함되어야 해요:",
"Bark Endpoint": "Bark Endpoint",
+ "Bark Group": "Bark Group",
+ "Bark Sound": "Bark Sound",
WebHookUrl: "웹훅 URL",
SecretKey: "Secret Key",
"For safety, must use secret key": "안전을 위해 꼭 Secret Key를 사용하세요.",
diff --git a/src/languages/nl-NL.js b/src/languages/nl-NL.js
index 96424a5f8..93bae56d8 100644
--- a/src/languages/nl-NL.js
+++ b/src/languages/nl-NL.js
@@ -397,6 +397,8 @@ export default {
SignName: "SignName",
"Sms template must contain parameters: ": "Sms sjabloon moet de volgende parameters bevatten: ",
"Bark Endpoint": "Bark Endpoint",
+ "Bark Group": "Bark Group",
+ "Bark Sound": "Bark Sound",
WebHookUrl: "WebHookUrl",
SecretKey: "SecretKey",
"For safety, must use secret key": "Voor de veiligheid moet je de secret key gebruiken",
diff --git a/src/languages/pl.js b/src/languages/pl.js
index ab2480d38..57a5cbe69 100644
--- a/src/languages/pl.js
+++ b/src/languages/pl.js
@@ -396,6 +396,8 @@ export default {
SignName: "Podpis",
"Sms template must contain parameters: ": "Szablon sms musi posiadać parametry: ",
"Bark Endpoint": "Punkt końcowy Bark",
+ "Bark Group": "grupa Bark",
+ "Bark Sound": "Dzwonek Bark",
WebHookUrl: "WebHookUrl",
SecretKey: "Tajny klucz",
"For safety, must use secret key": "Ze względów bezpieczeństwa musisz użyć tajnego klucza",
diff --git a/src/languages/th-TH.js b/src/languages/th-TH.js
index 70138ff46..1773de7ab 100644
--- a/src/languages/th-TH.js
+++ b/src/languages/th-TH.js
@@ -396,6 +396,8 @@ export default {
SignName: "ป้ายชื่อ",
"Sms template must contain parameters: ": "เทมเพลต SMS ต้องมีพารามิเตอร์ : ",
"Bark Endpoint": "Bark Endpoint",
+ "Bark Group": "Bark Group",
+ "Bark Sound": "Bark Sound",
WebHookUrl: "WebHookUrl",
SecretKey: "SecretKey",
"For safety, must use secret key": "เพื่อความปลอดภัย จำเป็นต้องตั้งค่ากุญแจการเข้าถึง",
diff --git a/src/languages/tr-TR.js b/src/languages/tr-TR.js
index 4904bdb79..bce1f0fdf 100644
--- a/src/languages/tr-TR.js
+++ b/src/languages/tr-TR.js
@@ -397,6 +397,8 @@ export default {
SignName: "SignName",
"Sms template must contain parameters: ": "Sms şablonu parametreleri içermelidir:",
"Bark Endpoint": "Bark Endpoint",
+ "Bark Group": "Bark Group",
+ "Bark Sound": "Bark Sound",
WebHookUrl: "WebHookUrl",
SecretKey: "SecretKey",
"For safety, must use secret key": "Güvenlik için gizli anahtar kullanılmalıdır",
diff --git a/src/languages/vi-VN.js b/src/languages/vi-VN.js
index 9005c3939..9d8da69ad 100644
--- a/src/languages/vi-VN.js
+++ b/src/languages/vi-VN.js
@@ -396,6 +396,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": "Để an toàn, hãy dùng secret key",
diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js
index 428d56bb6..003fdd7a6 100644
--- a/src/languages/zh-CN.js
+++ b/src/languages/zh-CN.js
@@ -402,6 +402,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 ff849adb8..1118d1004 100644
--- a/src/languages/zh-TW.js
+++ b/src/languages/zh-TW.js
@@ -396,6 +396,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": "為了安全起見,必須使用秘密金鑰",