Merge branch 'master' into add-wecom-notification

pull/1095/head
Leslie Leung 2 years ago committed by GitHub
commit 590859a95b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,47 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
const { setting } = require("../util-server");
const { getMonitorRelativeURL } = require("../../src/util");
const { DOWN, UP } = 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\n`;
} else if (heartbeatJSON && heartbeatJSON.status === DOWN) {
textMsg = `🔴 Application went down\n`;
}
if (monitorJSON && monitorJSON.name) {
textMsg += `*${monitorJSON.name}*\n`;
}
textMsg += `${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;

@ -26,6 +26,7 @@ const Bark = require("./notification-providers/bark");
const SerwerSMS = require("./notification-providers/serwersms"); const SerwerSMS = require("./notification-providers/serwersms");
const Stackfield = require("./notification-providers/stackfield"); const Stackfield = require("./notification-providers/stackfield");
const WeCom = require("./notification-providers/wecom"); const WeCom = require("./notification-providers/wecom");
const GoogleChat = require("./notification-providers/google-chat");
class Notification { class Notification {
@ -64,6 +65,7 @@ class Notification {
new SerwerSMS(), new SerwerSMS(),
new Stackfield(), new Stackfield(),
new WeCom(), new WeCom(),
new GoogleChat()
]; ];
for (let item of list) { for (let item of list) {

@ -0,0 +1,13 @@
<template>
<div class="mb-3">
<label for="google-chat-webhook-url" class="form-label">{{ $t("Webhook URL") }}<span style="color: red;"><sup>*</sup></span></label>
<input id="google-chat-webhook-url" v-model="$parent.notification.googleChatWebhookURL" type="text" class="form-control" required>
<div class="form-text">
<span style="color: red;"><sup>*</sup></span>{{ $t("Required") }}
<i18n-t tag="p" keypath="aboutWebhooks" style="margin-top: 8px;">
<a href="https://developers.google.com/chat/how-tos/webhooks" target="_blank">https://developers.google.com/chat/how-tos/webhooks</a>
</i18n-t>
</div>
</div>
</template>

@ -1,4 +1,4 @@
import STMP from "./SMTP.vue" import STMP from "./SMTP.vue";
import Telegram from "./Telegram.vue"; import Telegram from "./Telegram.vue";
import Discord from "./Discord.vue"; import Discord from "./Discord.vue";
import Webhook from "./Webhook.vue"; import Webhook from "./Webhook.vue";
@ -25,6 +25,7 @@ import Bark from "./Bark.vue";
import SerwerSMS from "./SerwerSMS.vue"; import SerwerSMS from "./SerwerSMS.vue";
import Stackfield from './Stackfield.vue'; import Stackfield from './Stackfield.vue';
import WeCom from "./WeCom.vue"; import WeCom from "./WeCom.vue";
import GoogleChat from "./GoogleChat.vue";
/** /**
* Manage all notification form. * Manage all notification form.
@ -59,6 +60,7 @@ const NotificationFormList = {
"serwersms": SerwerSMS, "serwersms": SerwerSMS,
"stackfield": Stackfield, "stackfield": Stackfield,
"WeCom": WeCom, "WeCom": WeCom,
} "Google Chat (Google Workspace only)": GoogleChat
};
export default NotificationFormList export default NotificationFormList;

@ -200,7 +200,7 @@ export default {
"Primary Base URL": "Основен базов URL адрес", "Primary Base URL": "Основен базов URL адрес",
"Push URL": "Генериран Push URL адрес", "Push URL": "Генериран Push URL адрес",
needPushEvery: "Необходимо е да извършвате заявка към този URL адрес на всеки {0} секунди", needPushEvery: "Необходимо е да извършвате заявка към този URL адрес на всеки {0} секунди",
pushOptionalParams: "Допълнителни, но незадължителни параметри: {0}", pushOptionalParams: "Допълнителни, но не задължителни параметри: {0}",
defaultNotificationName: "Моето {notification} известяване ({number})", defaultNotificationName: "Моето {notification} известяване ({number})",
here: "тук", here: "тук",
Required: "Задължително поле", Required: "Задължително поле",
@ -351,4 +351,13 @@ export default {
serwersmsPhoneNumber: "Телефон номер", serwersmsPhoneNumber: "Телефон номер",
serwersmsSenderName: "SMS Подател име (регистриран през клиентския портал)", serwersmsSenderName: "SMS Подател име (регистриран през клиентския портал)",
stackfield: "Stackfield", stackfield: "Stackfield",
smtpDkimSettings: "DKIM Настройки",
smtpDkimDesc: "Моля, вижте Nodemailer DKIM {0} за инструкции.",
documentation: "документация",
smtpDkimDomain: "Домейн",
smtpDkimKeySelector: "Селектор на ключ",
smtpDkimPrivateKey: "Частен ключ",
smtpDkimHashAlgo: "Хеш алгоритъм (по желание)",
smtpDkimheaderFieldNames: "Хедър ключове за подписване (по желание)",
smtpDkimskipFields: "Хедър ключове, които да не се подписеат (по желание)",
}; };

@ -207,7 +207,7 @@ export default {
"Discord Webhook URL": "Discord Webhook URL", "Discord Webhook URL": "Discord Webhook URL",
wayToGetDiscordURL: "Vous pouvez l'obtenir en allant dans 'Paramètres du Serveur' -> 'Intégrations' -> 'Créer un Webhook'", 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é)", "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...", "Hello @everyone is...": "Bonjour {'@'}everyone il...",
teams: "Microsoft Teams", teams: "Microsoft Teams",
"Webhook URL": "Webhook URL", "Webhook URL": "Webhook URL",
@ -229,7 +229,7 @@ export default {
aboutWebhooks: "Plus d'informations sur les Webhooks ici : {0}", 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", 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.", 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", "rocket.chat": "Rocket.chat",
pushover: "Pushover", pushover: "Pushover",
pushy: "Pushy", pushy: "Pushy",
@ -262,9 +262,9 @@ export default {
appriseInstalled: "Apprise est installé.", appriseInstalled: "Apprise est installé.",
appriseNotInstalled: "Apprise n'est pas installé. {0}", appriseNotInstalled: "Apprise n'est pas installé. {0}",
"Access Token": "Access Token", "Access Token": "Access Token",
"Channel access token": "Channel access token", "Channel access token": "Token d'accès au canal",
"Line Developers Console": "Line Developers Console", "Line Developers Console": "Ligne console de développeurs",
lineDevConsoleTo: "Line Developers Console - {0}", lineDevConsoleTo: "Ligne console de développeurs - {0}",
"Basic Settings": "Paramètres de base", "Basic Settings": "Paramètres de base",
"User ID": "Identifiant utilisateur", "User ID": "Identifiant utilisateur",
"Messaging API": "Messaging API", "Messaging API": "Messaging API",

@ -351,4 +351,13 @@ export default {
serwersmsPhoneNumber: "Numero di Telefono", serwersmsPhoneNumber: "Numero di Telefono",
serwersmsSenderName: "Nome del mittente SMS (registrato via portale cliente)", serwersmsSenderName: "Nome del mittente SMS (registrato via portale cliente)",
stackfield: "Stackfield", 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)",
}; };

Loading…
Cancel
Save