From 8050cb8e99fed911f69b78b2d99994e2f180ef14 Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Sat, 11 Dec 2021 23:43:12 +0100 Subject: [PATCH 1/9] implement google chat notification type --- server/notification-providers/google-chat.js | 46 ++++++++++++++++++++ server/notification.js | 2 + src/components/notifications/GoogleChat.vue | 13 ++++++ src/components/notifications/index.js | 2 + 4 files changed, 63 insertions(+) create mode 100644 server/notification-providers/google-chat.js create mode 100644 src/components/notifications/GoogleChat.vue diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js new file mode 100644 index 00000000..f73f4b5a --- /dev/null +++ b/server/notification-providers/google-chat.js @@ -0,0 +1,46 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); +const { setting } = require("../util-server"); +const { getMonitorRelativeURL } = require("../../src/util"); + +class GoogleChat extends NotificationProvider { + + name = "Google Chat"; + + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + let okMsg = "Sent Successfully."; + try { + // Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic + + let textMsg = '' + if (heartbeatJSON && heartbeatJSON.status === UP) { + textMsg = `✅ Application is back online`; + } else { + textMsg = `🔴 Application went down`; + } + + if (monitorJSON && monitorJSON.name) { + textMsg += `\n*${monitorJSON.name}*`; + } + + textMsg += `\n${msg}`; + + const baseURL = await setting("primaryBaseURL"); + if (baseURL) { + textMsg += `\n${baseURL + getMonitorRelativeURL(monitorJSON.id)}`; + } + + const data = { + "text": textMsg, + }; + + await axios.post(notification.googleChatWebhookURL, data); + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + + } +} + +module.exports = GoogleChat; diff --git a/server/notification.js b/server/notification.js index 3eb5f97b..56a7e84d 100644 --- a/server/notification.js +++ b/server/notification.js @@ -25,6 +25,7 @@ const DingDing = require("./notification-providers/dingding"); const Bark = require("./notification-providers/bark"); const SerwerSMS = require("./notification-providers/serwersms"); const Stackfield = require("./notification-providers/stackfield"); +const GoogleChat = require("./notification-providers/google-chat"); class Notification { @@ -62,6 +63,7 @@ class Notification { new Bark(), new SerwerSMS(), new Stackfield(), + new GoogleChat() ]; for (let item of list) { diff --git a/src/components/notifications/GoogleChat.vue b/src/components/notifications/GoogleChat.vue new file mode 100644 index 00000000..c19cae0d --- /dev/null +++ b/src/components/notifications/GoogleChat.vue @@ -0,0 +1,13 @@ + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 155a1ab2..67810610 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -24,6 +24,7 @@ import DingDing from "./DingDing.vue"; import Bark from "./Bark.vue"; import SerwerSMS from "./SerwerSMS.vue"; import Stackfield from './Stackfield.vue'; +import GoogleChat from './GoogleChat.vue'; /** * Manage all notification form. @@ -57,6 +58,7 @@ const NotificationFormList = { "Bark": Bark, "serwersms": SerwerSMS, "stackfield": Stackfield, + "Google Chat": GoogleChat } export default NotificationFormList From 83984668608fc9f3ff8e01f6c90fec4d8ecffff3 Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Sat, 11 Dec 2021 23:50:03 +0100 Subject: [PATCH 2/9] order notification types by name --- src/components/notifications/index.js | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 67810610..a7c967ed 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -32,33 +32,33 @@ import GoogleChat from './GoogleChat.vue'; * @type { Record } */ const NotificationFormList = { - "telegram": Telegram, - "webhook": Webhook, - "smtp": STMP, + "AliyunSMS": AliyunSMS, + "apprise": Apprise, + "Bark": Bark, + "clicksendsms": ClickSendSMS, + "DingDing": DingDing, "discord": Discord, - "teams": Teams, - "signal": Signal, + "smtp": STMP, + "Feishu": Feishu, + "Google Chat": GoogleChat, "gotify": Gotify, - "slack": Slack, - "rocket.chat": RocketChat, - "pushover": Pushover, - "pushy": Pushy, + "line": Line, + "lunasea": LunaSea, + "matrix": Matrix, + "mattermost": Mattermost, "octopush": Octopush, "promosms": PromoSMS, - "clicksendsms": ClickSendSMS, - "lunasea": LunaSea, - "Feishu": Feishu, - "AliyunSMS": AliyunSMS, - "apprise": Apprise, "pushbullet": Pushbullet, - "line": Line, - "mattermost": Mattermost, - "matrix": Matrix, - "DingDing": DingDing, - "Bark": Bark, + "pushover": Pushover, + "pushy": Pushy, + "rocket.chat": RocketChat, "serwersms": SerwerSMS, + "signal": Signal, + "slack": Slack, "stackfield": Stackfield, - "Google Chat": GoogleChat + "teams": Teams, + "telegram": Telegram, + "webhook": Webhook } export default NotificationFormList From a71569379ea9bbab2360ed0b129865124721ebf3 Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Sun, 12 Dec 2021 00:01:12 +0100 Subject: [PATCH 3/9] add missing import --- server/notification-providers/google-chat.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index f73f4b5a..897dd691 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -2,6 +2,7 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); const { setting } = require("../util-server"); const { getMonitorRelativeURL } = require("../../src/util"); +const { UP } = require("../../src/util"); class GoogleChat extends NotificationProvider { From 8ad6bd31d40f67c58f542cfc8775765eed7cb47b Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Sun, 12 Dec 2021 00:08:33 +0100 Subject: [PATCH 4/9] Revert "order notification types by name" This reverts commit 83984668608fc9f3ff8e01f6c90fec4d8ecffff3. --- src/components/notifications/index.js | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index a7c967ed..67810610 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -32,33 +32,33 @@ import GoogleChat from './GoogleChat.vue'; * @type { Record } */ const NotificationFormList = { - "AliyunSMS": AliyunSMS, - "apprise": Apprise, - "Bark": Bark, - "clicksendsms": ClickSendSMS, - "DingDing": DingDing, - "discord": Discord, + "telegram": Telegram, + "webhook": Webhook, "smtp": STMP, - "Feishu": Feishu, - "Google Chat": GoogleChat, + "discord": Discord, + "teams": Teams, + "signal": Signal, "gotify": Gotify, - "line": Line, - "lunasea": LunaSea, - "matrix": Matrix, - "mattermost": Mattermost, + "slack": Slack, + "rocket.chat": RocketChat, + "pushover": Pushover, + "pushy": Pushy, "octopush": Octopush, "promosms": PromoSMS, + "clicksendsms": ClickSendSMS, + "lunasea": LunaSea, + "Feishu": Feishu, + "AliyunSMS": AliyunSMS, + "apprise": Apprise, "pushbullet": Pushbullet, - "pushover": Pushover, - "pushy": Pushy, - "rocket.chat": RocketChat, + "line": Line, + "mattermost": Mattermost, + "matrix": Matrix, + "DingDing": DingDing, + "Bark": Bark, "serwersms": SerwerSMS, - "signal": Signal, - "slack": Slack, "stackfield": Stackfield, - "teams": Teams, - "telegram": Telegram, - "webhook": Webhook + "Google Chat": GoogleChat } export default NotificationFormList From a6072a0e306d44c5a5094601e8d6661e31f50878 Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Wed, 15 Dec 2021 13:40:21 +0100 Subject: [PATCH 5/9] google chat: only show offline message in notification when service went down --- server/notification-providers/google-chat.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index 897dd691..1610553c 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -2,7 +2,7 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); const { setting } = require("../util-server"); const { getMonitorRelativeURL } = require("../../src/util"); -const { UP } = require("../../src/util"); +const { DOWN, UP } = require("../../src/util"); class GoogleChat extends NotificationProvider { @@ -15,16 +15,16 @@ class GoogleChat extends NotificationProvider { let textMsg = '' if (heartbeatJSON && heartbeatJSON.status === UP) { - textMsg = `✅ Application is back online`; - } else { - textMsg = `🔴 Application went down`; + textMsg = `✅ Application is back online\n`; + } else if (heartbeatJSON && heartbeatJSON.status === DOWN) { + textMsg = `🔴 Application went down\n`; } if (monitorJSON && monitorJSON.name) { - textMsg += `\n*${monitorJSON.name}*`; + textMsg += `*${monitorJSON.name}*\n`; } - textMsg += `\n${msg}`; + textMsg += `${msg}`; const baseURL = await setting("primaryBaseURL"); if (baseURL) { From a2bc74c4fd1465f0308d593f893e3e39850c45a1 Mon Sep 17 00:00:00 2001 From: Ioma Taani Date: Fri, 24 Dec 2021 12:02:50 +0100 Subject: [PATCH 6/9] updated --- src/languages/it-IT.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/languages/it-IT.js b/src/languages/it-IT.js index 5a38a5aa..9aff1de0 100644 --- a/src/languages/it-IT.js +++ b/src/languages/it-IT.js @@ -351,4 +351,13 @@ export default { serwersmsPhoneNumber: "Numero di Telefono", serwersmsSenderName: "Nome del mittente SMS (registrato via portale cliente)", stackfield: "Stackfield", + smtpDkimSettings: "Impostazioni DKIM", + smtpDkimDesc: "Fare riferimento a Nodemailer DKIM {0} per l'utilizzo.", + documentation: "documentazione", + smtpDkimDomain: "Dominio", + smtpDkimKeySelector: "Selettore Chiave", + smtpDkimPrivateKey: "Chiave Privata", + smtpDkimHashAlgo: "Algoritmo di hashing (opzionale)", + smtpDkimheaderFieldNames: "Campi Intestazione da firmare (opzionale)", + smtpDkimskipFields: "Campi Intestazione da non firmare (opzionale)", }; From f6fc3737fcb7d27582bd0dde6732157efc43138f Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 30 Dec 2021 00:10:54 +0800 Subject: [PATCH 7/9] Change name from "Google Chat" to Google Chat (Google Workspace only) --- src/components/notifications/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 67810610..9d870f91 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -1,4 +1,4 @@ -import STMP from "./SMTP.vue" +import STMP from "./SMTP.vue"; import Telegram from "./Telegram.vue"; import Discord from "./Discord.vue"; import Webhook from "./Webhook.vue"; @@ -23,8 +23,8 @@ import AliyunSMS from "./AliyunSms.vue"; import DingDing from "./DingDing.vue"; import Bark from "./Bark.vue"; import SerwerSMS from "./SerwerSMS.vue"; -import Stackfield from './Stackfield.vue'; -import GoogleChat from './GoogleChat.vue'; +import Stackfield from "./Stackfield.vue"; +import GoogleChat from "./GoogleChat.vue"; /** * Manage all notification form. @@ -58,7 +58,7 @@ const NotificationFormList = { "Bark": Bark, "serwersms": SerwerSMS, "stackfield": Stackfield, - "Google Chat": GoogleChat -} + "Google Chat (Google Workspace only)": GoogleChat +}; -export default NotificationFormList +export default NotificationFormList; From d7cb4fa331260514f5d1fddab242bfb0623bc9e5 Mon Sep 17 00:00:00 2001 From: MrEddX <66828538+MrEddX@users.noreply.github.com> Date: Thu, 30 Dec 2021 08:12:25 +0200 Subject: [PATCH 8/9] Update bg-BG.js - Updated Bulgarian language file --- src/languages/bg-BG.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js index 180b766d..a731ad09 100644 --- a/src/languages/bg-BG.js +++ b/src/languages/bg-BG.js @@ -200,7 +200,7 @@ export default { "Primary Base URL": "Основен базов URL адрес", "Push URL": "Генериран Push URL адрес", needPushEvery: "Необходимо е да извършвате заявка към този URL адрес на всеки {0} секунди", - pushOptionalParams: "Допълнителни, но незадължителни параметри: {0}", + pushOptionalParams: "Допълнителни, но не задължителни параметри: {0}", defaultNotificationName: "Моето {notification} известяване ({number})", here: "тук", Required: "Задължително поле", @@ -351,4 +351,13 @@ export default { serwersmsPhoneNumber: "Телефон номер", serwersmsSenderName: "SMS Подател име (регистриран през клиентския портал)", stackfield: "Stackfield", + smtpDkimSettings: "DKIM Настройки", + smtpDkimDesc: "Моля, вижте Nodemailer DKIM {0} за инструкции.", + documentation: "документация", + smtpDkimDomain: "Домейн", + smtpDkimKeySelector: "Селектор на ключ", + smtpDkimPrivateKey: "Частен ключ", + smtpDkimHashAlgo: "Хеш алгоритъм (по желание)", + smtpDkimheaderFieldNames: "Хедър ключове за подписване (по желание)", + smtpDkimskipFields: "Хедър ключове, които да не се подписеат (по желание)", }; From 4b07ec23fec01f679f302cfea3d84201cdcdc56e Mon Sep 17 00:00:00 2001 From: Minvinea <29579830+Minvinea@users.noreply.github.com> Date: Mon, 3 Jan 2022 00:27:51 +0100 Subject: [PATCH 9/9] Update --- src/languages/fr-FR.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/languages/fr-FR.js b/src/languages/fr-FR.js index bf98dd8d..04dede1b 100644 --- a/src/languages/fr-FR.js +++ b/src/languages/fr-FR.js @@ -207,7 +207,7 @@ export default { "Discord Webhook URL": "Discord Webhook URL", wayToGetDiscordURL: "Vous pouvez l'obtenir en allant dans 'Paramètres du Serveur' -> 'Intégrations' -> 'Créer un Webhook'", "Bot Display Name": "Nom du bot (affiché)", - "Prefix Custom Message": "Prefix Custom Message", + "Prefix Custom Message": "Prefixe du message personnalisé", "Hello @everyone is...": "Bonjour {'@'}everyone il...", teams: "Microsoft Teams", "Webhook URL": "Webhook URL", @@ -229,7 +229,7 @@ export default { aboutWebhooks: "Plus d'informations sur les Webhooks ici : {0}", aboutChannelName: "Mettez le nom du salon dans {0} dans 'Channel Name' si vous voulez bypass le salon Webhook. Ex : #autre-salon", aboutKumaURL: "Si vous laissez l'URL d'Uptime Kuma vierge, elle redirigera vers la page du projet GitHub.", - emojiCheatSheet: "Emoji cheat sheet : {0}", + emojiCheatSheet: "Aide emoji : {0}", "rocket.chat": "Rocket.chat", pushover: "Pushover", pushy: "Pushy", @@ -262,9 +262,9 @@ export default { appriseInstalled: "Apprise est installé.", appriseNotInstalled: "Apprise n'est pas installé. {0}", "Access Token": "Access Token", - "Channel access token": "Channel access token", - "Line Developers Console": "Line Developers Console", - lineDevConsoleTo: "Line Developers Console - {0}", + "Channel access token": "Token d'accès au canal", + "Line Developers Console": "Ligne console de développeurs", + lineDevConsoleTo: "Ligne console de développeurs - {0}", "Basic Settings": "Paramètres de base", "User ID": "Identifiant utilisateur", "Messaging API": "Messaging API",