From 8c941b1d565b1f3ff61450f91b6e9a6e56d20543 Mon Sep 17 00:00:00 2001 From: zsxeee Date: Tue, 21 Sep 2021 13:02:41 +0800 Subject: [PATCH 01/10] Add i18n for notification form --- src/components/notifications/Apprise.vue | 19 ++--- src/components/notifications/Discord.vue | 11 ++- src/components/notifications/Gotify.vue | 6 +- src/components/notifications/Line.vue | 20 ++--- src/components/notifications/LunaSea.vue | 4 +- src/components/notifications/Mattermost.vue | 30 +++---- src/components/notifications/Octopush.vue | 22 ++--- src/components/notifications/Pushbullet.vue | 8 +- src/components/notifications/Pushover.vue | 24 +++--- src/components/notifications/Pushy.vue | 6 +- src/components/notifications/RocketChat.vue | 28 +++---- src/components/notifications/SMTP.vue | 14 ++-- src/components/notifications/Signal.vue | 14 ++-- src/components/notifications/Slack.vue | 28 +++---- src/components/notifications/Teams.vue | 9 +- src/components/notifications/Telegram.vue | 16 ++-- src/components/notifications/Webhook.vue | 9 +- src/languages/en.js | 93 +++++++++++++++++++++ 18 files changed, 228 insertions(+), 133 deletions(-) diff --git a/src/components/notifications/Apprise.vue b/src/components/notifications/Apprise.vue index de3fe52b..567b1eae 100644 --- a/src/components/notifications/Apprise.vue +++ b/src/components/notifications/Apprise.vue @@ -1,20 +1,19 @@ diff --git a/src/components/notifications/Discord.vue b/src/components/notifications/Discord.vue index c45a5262..99389d29 100644 --- a/src/components/notifications/Discord.vue +++ b/src/components/notifications/Discord.vue @@ -1,20 +1,19 @@ diff --git a/src/components/notifications/Gotify.vue b/src/components/notifications/Gotify.vue index f8039d58..9e16d4e4 100644 --- a/src/components/notifications/Gotify.vue +++ b/src/components/notifications/Gotify.vue @@ -1,17 +1,17 @@ diff --git a/src/components/notifications/Line.vue b/src/components/notifications/Line.vue index 7d5312c3..f6dbc748 100644 --- a/src/components/notifications/Line.vue +++ b/src/components/notifications/Line.vue @@ -1,21 +1,21 @@ diff --git a/src/languages/en.js b/src/languages/en.js index ca568944..c4525aef 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -169,6 +169,7 @@ export default { "Avg. Ping": "Avg. Ping", "Avg. Response": "Avg. Response", // Start notification form + defaultNotificationName: "My {0} Alert ({1})", here: "here", "Required": "Required", From 6e55c447732cd17827bfbdb8ead5bb04715893d5 Mon Sep 17 00:00:00 2001 From: zsxeee Date: Wed, 22 Sep 2021 16:13:23 +0800 Subject: [PATCH 03/10] Chore --- src/components/NotificationDialog.vue | 3 +-- src/components/notifications/Apprise.vue | 2 +- src/components/notifications/Signal.vue | 2 +- src/languages/en.js | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 2cf5eed2..fb8ff2e0 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -108,7 +108,6 @@ export default { watch: { "notification.type"(to, from) { let oldName; - console.log(this.$root.notificationList) if (from) { oldName = this.getUniqueDefaultName(from); } else { @@ -193,7 +192,7 @@ export default { }) }, /** - * @param {string} notificationKey + * @param {keyof NotificationFormList} notificationKey * @return {string} */ getUniqueDefaultName(notificationKey) { diff --git a/src/components/notifications/Apprise.vue b/src/components/notifications/Apprise.vue index 567b1eae..e0f116f0 100644 --- a/src/components/notifications/Apprise.vue +++ b/src/components/notifications/Apprise.vue @@ -11,7 +11,7 @@
- {{ $t("Apprise is installed") }} + {{ $t("Apprise is installed. ") }} {{ $t("Apprise is not installed. ") }}{{ $t("Read more") }}
diff --git a/src/components/notifications/Signal.vue b/src/components/notifications/Signal.vue index 212aba6a..e3c9e7aa 100644 --- a/src/components/notifications/Signal.vue +++ b/src/components/notifications/Signal.vue @@ -19,7 +19,7 @@

- {{ $t("canCheckLike") }} + {{ $t("wayToCheckSignalURL") }}

diff --git a/src/languages/en.js b/src/languages/en.js index c4525aef..c9775403 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -212,7 +212,7 @@ export default { "Number": "Number", "Recipients": "Recipients", needSignalAPI: "You need to have a signal client with REST API.", - canCheckLike: "You can check this url to view how to setup one:", + wayToCheckSignalURL: "You can check this url to view how to setup one:", signalImportant: "IMPORTANT: You cannot mix groups and numbers in recipients!", "gotify": "Gotify", @@ -259,7 +259,7 @@ export default { "Read more:": "Read more: {0}", "Status:": "Status: {0}", "Read more": "Read more", - "Apprise is installed": "Apprise is installed", + "Apprise is installed. ": "Apprise is installed. ", "Apprise is not installed. ": "Apprise is not installed. ", "pushbullet": "Pushbullet", From 6e9d12638c5909cdf9185401fef1bca120e7d56a Mon Sep 17 00:00:00 2001 From: zsxeee Date: Wed, 22 Sep 2021 16:20:59 +0800 Subject: [PATCH 04/10] Avoid space ending in translation key --- src/components/notifications/Apprise.vue | 4 ++-- src/components/notifications/Line.vue | 4 ++-- src/languages/en.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/notifications/Apprise.vue b/src/components/notifications/Apprise.vue index e0f116f0..30abfc90 100644 --- a/src/components/notifications/Apprise.vue +++ b/src/components/notifications/Apprise.vue @@ -11,8 +11,8 @@

- {{ $t("Apprise is installed. ") }} - {{ $t("Apprise is not installed. ") }}{{ $t("Read more") }} + {{ $t("Apprise is installed.") }} + {{ $t("Apprise is not installed.") }}{{ $t("Read more") }}
diff --git a/src/components/notifications/Line.vue b/src/components/notifications/Line.vue index f6dbc748..0d7da26a 100644 --- a/src/components/notifications/Line.vue +++ b/src/components/notifications/Line.vue @@ -3,14 +3,14 @@ - + {{ $t("Basic Settings") }}
- + {{ $t("Messaging API") }} diff --git a/src/languages/en.js b/src/languages/en.js index c9775403..948ed437 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -259,8 +259,8 @@ export default { "Read more:": "Read more: {0}", "Status:": "Status: {0}", "Read more": "Read more", - "Apprise is installed. ": "Apprise is installed. ", - "Apprise is not installed. ": "Apprise is not installed. ", + "Apprise is installed.": "Apprise is installed. ", + "Apprise is not installed.": "Apprise is not installed. ", "pushbullet": "Pushbullet", "Access Token": "Access Token", @@ -268,7 +268,7 @@ export default { "line": "Line Messenger", "Channel access token": "Channel access token", "Line Developers Console": "Line Developers Console", - "Line Developers Console - ": "Line Developers Console - {0}", + lineDevConsoleTo: "Line Developers Console - {0}", "Basic Settings": "Basic Settings", "User ID": "User ID", "Messaging API": "Messaging API", From 624f632a7a537d3b21ef0c5d55b6b108a5046df2 Mon Sep 17 00:00:00 2001 From: zsxeee Date: Wed, 22 Sep 2021 22:15:50 +0800 Subject: [PATCH 05/10] Apprise status translation key --- src/components/NotificationDialog.vue | 2 +- src/components/notifications/Apprise.vue | 6 ++++-- src/languages/en.js | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index fb8ff2e0..0c2035de 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -200,7 +200,7 @@ export default { let name = "" do { name = this.$t("defaultNotificationName", [ - this.$t(notificationKey).replace(/\(.+\)/, ""), + this.$t(notificationKey).replace(/\(.+\)/, "").trim(), index++ ]); } while (this.$root.notificationList.find(it => it.name === name)) diff --git a/src/components/notifications/Apprise.vue b/src/components/notifications/Apprise.vue index 30abfc90..f485405b 100644 --- a/src/components/notifications/Apprise.vue +++ b/src/components/notifications/Apprise.vue @@ -11,8 +11,10 @@
- {{ $t("Apprise is installed.") }} - {{ $t("Apprise is not installed.") }}{{ $t("Read more") }} + {{ $t("appriseInstalled") }} + + {{ $t("Read more") }} +
diff --git a/src/languages/en.js b/src/languages/en.js index 948ed437..64546797 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -259,8 +259,8 @@ export default { "Read more:": "Read more: {0}", "Status:": "Status: {0}", "Read more": "Read more", - "Apprise is installed.": "Apprise is installed. ", - "Apprise is not installed.": "Apprise is not installed. ", + appriseInstalled: "Apprise is installed.", + appriseNotInstalled: "Apprise is not installed. {0}", "pushbullet": "Pushbullet", "Access Token": "Access Token", From 138ddf56089d7dea14669ff7a62458a7ad264f2a Mon Sep 17 00:00:00 2001 From: zsxeee Date: Thu, 30 Sep 2021 19:22:17 +0800 Subject: [PATCH 06/10] Move attribute `tag` to start of tag --- src/components/notifications/Apprise.vue | 12 ++++++------ src/components/notifications/Line.vue | 8 ++++---- src/components/notifications/Mattermost.vue | 4 ++-- src/components/notifications/Octopush.vue | 6 +++--- src/components/notifications/Pushbullet.vue | 4 ++-- src/components/notifications/Pushover.vue | 2 +- src/components/notifications/Pushy.vue | 4 ++-- src/components/notifications/RocketChat.vue | 4 ++-- src/components/notifications/Slack.vue | 4 ++-- src/components/notifications/Teams.vue | 2 +- src/components/notifications/Webhook.vue | 2 +- src/languages/en.js | 17 ----------------- 12 files changed, 26 insertions(+), 43 deletions(-) diff --git a/src/components/notifications/Apprise.vue b/src/components/notifications/Apprise.vue index f485405b..c10e23cf 100644 --- a/src/components/notifications/Apprise.vue +++ b/src/components/notifications/Apprise.vue @@ -4,15 +4,15 @@

{{ $t("Example:", ["twilio://AccountSid:AuthToken@FromPhoneNo"]) }}

- + https://github.com/caronc/apprise/wiki#notification-services
- + {{ $t("appriseInstalled") }} - + {{ $t("Read more") }} @@ -24,12 +24,12 @@ export default { data() { return { appriseInstalled: false - } + }; }, mounted() { this.$root.getSocket().emit("checkApprise", (installed) => { this.appriseInstalled = installed; - }) + }); }, -} +}; diff --git a/src/components/notifications/Line.vue b/src/components/notifications/Line.vue index 0d7da26a..cb52c0c1 100644 --- a/src/components/notifications/Line.vue +++ b/src/components/notifications/Line.vue @@ -3,17 +3,17 @@
- + {{ $t("Basic Settings") }}
- + {{ $t("Messaging API") }} - + {{ $t("Line Developers Console") }} @@ -25,5 +25,5 @@ export default { components: { HiddenInput, }, -} +}; diff --git a/src/components/notifications/Mattermost.vue b/src/components/notifications/Mattermost.vue index 4c6e6918..2d174146 100644 --- a/src/components/notifications/Mattermost.vue +++ b/src/components/notifications/Mattermost.vue @@ -12,7 +12,7 @@
*{{ $t("Required") }} - + https://docs.mattermost.com/developer/webhooks-incoming.html

@@ -24,7 +24,7 @@

{{ $t("aboutIconURL") }}

- + https://www.webfx.com/tools/emoji-cheat-sheet/
diff --git a/src/components/notifications/Octopush.vue b/src/components/notifications/Octopush.vue index b8ea6dfa..fb0eb7f4 100644 --- a/src/components/notifications/Octopush.vue +++ b/src/components/notifications/Octopush.vue @@ -11,7 +11,7 @@ - + https://octopush.com/tarifs-sms-international/ @@ -24,7 +24,7 @@ - + https://octopush.com/api-sms-documentation/envoi-de-sms/ @@ -36,5 +36,5 @@ export default { components: { HiddenInput, }, -} +}; diff --git a/src/components/notifications/Pushbullet.vue b/src/components/notifications/Pushbullet.vue index ea848222..37a2e095 100644 --- a/src/components/notifications/Pushbullet.vue +++ b/src/components/notifications/Pushbullet.vue @@ -4,7 +4,7 @@ - + https://docs.pushbullet.com @@ -16,5 +16,5 @@ export default { components: { HiddenInput, }, -} +}; diff --git a/src/components/notifications/Pushover.vue b/src/components/notifications/Pushover.vue index 7f0a9417..af6e9d83 100644 --- a/src/components/notifications/Pushover.vue +++ b/src/components/notifications/Pushover.vue @@ -43,7 +43,7 @@
*{{ $t("Required") }} - + https://pushover.net/api

diff --git a/src/components/notifications/Pushy.vue b/src/components/notifications/Pushy.vue index b980f546..26f404d2 100644 --- a/src/components/notifications/Pushy.vue +++ b/src/components/notifications/Pushy.vue @@ -10,7 +10,7 @@

- + https://pushy.me/docs/api/send-notifications @@ -22,5 +22,5 @@ export default { components: { HiddenInput, }, -} +}; diff --git a/src/components/notifications/RocketChat.vue b/src/components/notifications/RocketChat.vue index 328da8bd..8f808210 100644 --- a/src/components/notifications/RocketChat.vue +++ b/src/components/notifications/RocketChat.vue @@ -12,7 +12,7 @@
*{{ $t("Required") }} - + https://api.slack.com/messaging/webhooks

@@ -21,7 +21,7 @@

{{ $t("aboutKumaURL") }}

- + https://www.webfx.com/tools/emoji-cheat-sheet/
diff --git a/src/components/notifications/Slack.vue b/src/components/notifications/Slack.vue index 9cd05fb5..8675922b 100644 --- a/src/components/notifications/Slack.vue +++ b/src/components/notifications/Slack.vue @@ -12,7 +12,7 @@
*{{ $t("Required") }} - + https://api.slack.com/messaging/webhooks

@@ -21,7 +21,7 @@

{{ $t("aboutKumaURL") }}

- + https://www.webfx.com/tools/emoji-cheat-sheet/
diff --git a/src/components/notifications/Teams.vue b/src/components/notifications/Teams.vue index 0c36cfed..2bc76486 100644 --- a/src/components/notifications/Teams.vue +++ b/src/components/notifications/Teams.vue @@ -8,7 +8,7 @@ class="form-control" required /> - +

"application/json" is good for any modern http servers such as express.js

- + "multipart/form-data" json_decode($_POST['data']) diff --git a/src/languages/en.js b/src/languages/en.js index 39464c3f..b4b7769d 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -182,7 +182,6 @@ export default { defaultNotificationName: "My {0} Alert ({1})", here: "here", "Required": "Required", - "telegram": "Telegram", "Bot Token": "Bot Token", "You can get a token from": "You can get a token from", @@ -191,13 +190,11 @@ export default { wayToGetTelegramChatID: "You can get your chat id by sending message to the bot and go to this url to view the chat_id:", "YOUR BOT TOKEN HERE": "YOUR BOT TOKEN HERE", chatIDNotFound: "Chat ID is not found, please send a message to this bot first", - "webhook": "Webhook", "Post URL": "Post URL", "Content Type": "Content Type", webhookJsonDesc: "{0} is good for any modern http servers such as express.js", webhookFormDataDesc: "{0} is good for PHP, you just need to parse the json by {1}", - "smtp": "Email (SMTP)", secureOptionNone: "None / STARTTLS (25, 587)", secureOptionTLS: "TLS (465)", @@ -206,30 +203,25 @@ export default { "To Email": "To Email", smtpCC: "CC", smtpBCC: "BCC", - "discord": "Discord", "Discord Webhook URL": "Discord Webhook URL", wayToGetDiscordURL: "You can get this by going to Server Settings -> Integrations -> Create Webhook", "Bot Display Name": "Bot Display Name", "Prefix Custom Message": "Prefix Custom Message", "Hello @everyone is...": "Hello @everyone is...", - "teams": "Microsoft Teams", "Webhook URL": "Webhook URL", wayToGetTeamsURL: "You can learn how to create a webhook url {0}.", - "signal": "Signal", "Number": "Number", "Recipients": "Recipients", needSignalAPI: "You need to have a signal client with REST API.", wayToCheckSignalURL: "You can check this url to view how to setup one:", signalImportant: "IMPORTANT: You cannot mix groups and numbers in recipients!", - "gotify": "Gotify", "Application Token": "Application Token", "Server URL": "Server URL", "Priority": "Priority", - "slack": "Slack", "Icon Emoji": "Icon Emoji", "Channel Name": "Channel Name", @@ -238,9 +230,7 @@ export default { aboutChannelName: "Enter the channel name on {0} Channel Name field if you want to bypass the webhook channel. Ex: #other-channel", aboutKumaURL: "If you leave the Uptime Kuma URL field blank, it will default to the Project Github page.", emojiCheatSheet: "Emoji cheat sheet: {0}", - "rocket.chat": "Rocket.chat", - "pushover": "Pushover", "User Key": "User Key", "Device": "Device", @@ -249,9 +239,7 @@ export default { "More info on:": "More info on: {0}", pushoverDesc1: "Emergency priority (2) has default 30 second timeout between retries and will expire after 1 hour.", pushoverDesc2: "If you want to send notifications to different devices, fill out Device field.", - "pushy": "Pushy", - "octopush": "Octopush", "SMS Type": "SMS Type", octopushTypePremium: "Premium (Fast - recommended for alerting)", @@ -259,10 +247,8 @@ export default { "Check octopush prices": "Check octopush prices {0}.", octopushPhoneNumber: "Phone number (intl format, eg : +33612345678) ", octopushSMSSender: "SMS Sender Name : 3-11 alphanumeric characters and space (a-zA-Z0-9)", - "lunasea": "LunaSea", "LunaSea Device ID": "LunaSea Device ID", - "apprise": "Apprise (Support 50+ Notification services)", "Apprise URL": "Apprise URL", "Example:": "Example: {0}", @@ -271,10 +257,8 @@ export default { "Read more": "Read more", appriseInstalled: "Apprise is installed.", appriseNotInstalled: "Apprise is not installed. {0}", - "pushbullet": "Pushbullet", "Access Token": "Access Token", - "line": "Line Messenger", "Channel access token": "Channel access token", "Line Developers Console": "Line Developers Console", @@ -283,7 +267,6 @@ export default { "User ID": "User ID", "Messaging API": "Messaging API", wayToGetLineChannelToken: "First access the {0}, create a provider and channel (Messaging API), then you can get the channel access token and user id from the above mentioned menu items.", - "mattermost": "Mattermost", "Icon URL": "Icon URL", aboutIconURL: "You can provide a link to a picture in \"Icon URL\" to override the default profile picture. Will not be used if Icon Emoji is set.", From 0f2059cde00e87d0a88ca052a4741b06c7a16294 Mon Sep 17 00:00:00 2001 From: zsxeee Date: Thu, 30 Sep 2021 19:48:24 +0800 Subject: [PATCH 07/10] Use named slot translation when has multi-slot --- src/components/NotificationDialog.vue | 52 ++++++++++++------------ src/components/notifications/Webhook.vue | 6 ++- src/languages/en.js | 4 +- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 0c2035de..659f5726 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -68,11 +68,11 @@