From 8c941b1d565b1f3ff61450f91b6e9a6e56d20543 Mon Sep 17 00:00:00 2001 From: zsxeee Date: Tue, 21 Sep 2021 13:02:41 +0800 Subject: [PATCH 01/14] 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 de3fe52b3..567b1eae7 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 c45a5262a..99389d29e 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 f8039d58a..9e16d4e43 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 7d5312c37..f6dbc7489 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 ca5689442..c4525aef8 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/14] 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 2cf5eed2d..fb8ff2e0a 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 567b1eae7..e0f116f03 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 212aba6a3..e3c9e7aaf 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 c4525aef8..c97754034 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/14] 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 e0f116f03..30abfc900 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 f6dbc7489..0d7da26a4 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 c97754034..948ed437a 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/14] 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 fb8ff2e0a..0c2035def 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 30abfc900..f485405b4 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 948ed437a..645467978 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/14] 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 f485405b4..c10e23cf9 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 0d7da26a4..cb52c0c1f 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 4c6e69189..2d174146a 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 b8ea6dfac..fb0eb7f47 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 ea848222d..37a2e095c 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 7f0a94173..af6e9d83f 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 b980f546d..26f404d29 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 328da8bd7..8f8082101 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 9cd05fb59..8675922be 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 0c36cfed0..2bc76486a 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 39464c3f0..b4b7769de 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/14] 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 0c2035def..659f57267 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -68,11 +68,11 @@