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 01/11] 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": "為了安全起見,必須使用秘密金鑰", From a41023ca2a05f1015021d30352b9e4f752778320 Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Sun, 12 Jun 2022 22:41:24 +0800 Subject: [PATCH 02/11] Update --- server/notification-providers/bark.js | 1 - 1 file changed, 1 deletion(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index a2c4966a2..b9113a749 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -50,7 +50,6 @@ class Bark extends NotificationProvider { */ appendAdditionalParameters(postUrl) { // grouping all our notifications - postUrl += "?group=" + barkNotificationGroup; if (notification.barkGroup != null) { postUrl += "&group=" + notification.barkGroup; } else { From 404923b7c82cdc633c637f364f0f2ccbb878d346 Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Sun, 12 Jun 2022 22:49:04 +0800 Subject: [PATCH 03/11] bugfix --- server/notification-providers/bark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index b9113a749..f9215c8af 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -48,7 +48,7 @@ class Bark extends NotificationProvider { * @param {string} postUrl URL to append parameters to * @returns {string} */ - appendAdditionalParameters(postUrl) { + appendAdditionalParameters(notification, postUrl) { // grouping all our notifications if (notification.barkGroup != null) { postUrl += "&group=" + notification.barkGroup; From a23ab9d1de03e0825f6c1206c141fcec98a41a8d Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Sun, 12 Jun 2022 23:18:32 +0800 Subject: [PATCH 04/11] Update --- src/components/notifications/Bark.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/notifications/Bark.vue b/src/components/notifications/Bark.vue index 70e4322d3..34d35db1f 100644 --- a/src/components/notifications/Bark.vue +++ b/src/components/notifications/Bark.vue @@ -18,7 +18,6 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
From 5f347b10ba88114a5c15757e4f86c96a3672e479 Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Mon, 13 Jun 2022 01:15:38 +0800 Subject: [PATCH 06/11] Update --- src/components/notifications/Bark.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/notifications/Bark.vue b/src/components/notifications/Bark.vue index 5ff01b1a7..6cac73d36 100644 --- a/src/components/notifications/Bark.vue +++ b/src/components/notifications/Bark.vue @@ -2,9 +2,6 @@
-
-

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

-
Date: Mon, 13 Jun 2022 01:30:27 +0800 Subject: [PATCH 07/11] Update --- src/languages/bg-BG.js | 2 -- src/languages/de-DE.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 -- 8 files changed, 16 deletions(-) diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js index 23b1b7264..6297062ae 100644 --- a/src/languages/bg-BG.js +++ b/src/languages/bg-BG.js @@ -389,8 +389,6 @@ 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 aeba230f8..e679937cf 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -389,8 +389,6 @@ 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/ko-KR.js b/src/languages/ko-KR.js index 0ed7a6f2e..da034167d 100644 --- a/src/languages/ko-KR.js +++ b/src/languages/ko-KR.js @@ -406,8 +406,6 @@ 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 93bae56d8..96424a5f8 100644 --- a/src/languages/nl-NL.js +++ b/src/languages/nl-NL.js @@ -397,8 +397,6 @@ 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 57a5cbe69..ab2480d38 100644 --- a/src/languages/pl.js +++ b/src/languages/pl.js @@ -396,8 +396,6 @@ 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 1773de7ab..70138ff46 100644 --- a/src/languages/th-TH.js +++ b/src/languages/th-TH.js @@ -396,8 +396,6 @@ 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 bce1f0fdf..4904bdb79 100644 --- a/src/languages/tr-TR.js +++ b/src/languages/tr-TR.js @@ -397,8 +397,6 @@ 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 9d8da69ad..9005c3939 100644 --- a/src/languages/vi-VN.js +++ b/src/languages/vi-VN.js @@ -396,8 +396,6 @@ 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", From 252709ff494d6e16f5689d05a069e19dcb4a9aeb Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Mon, 13 Jun 2022 17:06:05 +0800 Subject: [PATCH 08/11] Update server/notification-providers/bark.js Co-authored-by: Adam Stachowicz --- server/notification-providers/bark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index f9215c8af..8d5797246 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -53,8 +53,8 @@ class Bark extends NotificationProvider { if (notification.barkGroup != null) { postUrl += "&group=" + notification.barkGroup; } else { - postUrl += "&group=" + "UptimeKuma"; // default group + postUrl += "&group=" + "UptimeKuma"; } // set icon to uptime kuma icon, 11kb should be fine postUrl += "&icon=" + barkNotificationAvatar; From 55a6e5af425a1be2df58680aeaed4d726614050a Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Mon, 13 Jun 2022 17:06:12 +0800 Subject: [PATCH 09/11] Update server/notification-providers/bark.js Co-authored-by: Adam Stachowicz --- server/notification-providers/bark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index 8d5797246..21ee9b13c 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -62,8 +62,8 @@ class Bark extends NotificationProvider { if (notification.barkSound != null) { postUrl += "&sound=" + notification.barkSound; } else { - postUrl += "&sound=" + "telegraph"; // default sound + postUrl += "&sound=" + "telegraph"; } return postUrl; } From 1c4ddaeddf2c7d2f78ce881c73ae575a3cbfdb3a Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Mon, 13 Jun 2022 18:17:47 +0800 Subject: [PATCH 10/11] Update --- server/notification-providers/bark.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index 21ee9b13c..6b22ae490 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -53,7 +53,7 @@ class Bark extends NotificationProvider { if (notification.barkGroup != null) { postUrl += "&group=" + notification.barkGroup; } else { - // default group + // default group name postUrl += "&group=" + "UptimeKuma"; } // set icon to uptime kuma icon, 11kb should be fine @@ -62,7 +62,7 @@ class Bark extends NotificationProvider { if (notification.barkSound != null) { postUrl += "&sound=" + notification.barkSound; } else { - // default sound + // default app sound postUrl += "&sound=" + "telegraph"; } return postUrl; From 54b9698a05e21649ec78f64ec5187b41d885f9d9 Mon Sep 17 00:00:00 2001 From: Super Manito <68613938+SuperManito@users.noreply.github.com> Date: Mon, 13 Jun 2022 21:44:10 +0800 Subject: [PATCH 11/11] Update --- server/notification-providers/bark.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/notification-providers/bark.js b/server/notification-providers/bark.js index 6b22ae490..3258e7c52 100644 --- a/server/notification-providers/bark.js +++ b/server/notification-providers/bark.js @@ -49,20 +49,20 @@ class Bark extends NotificationProvider { * @returns {string} */ 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 group name + // default name postUrl += "&group=" + "UptimeKuma"; } - // 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 if (notification.barkSound != null) { postUrl += "&sound=" + notification.barkSound; } else { - // default app sound + // default sound postUrl += "&sound=" + "telegraph"; } return postUrl;