From 40b70277c7a26ac64b880e5595f5ab69d55575d9 Mon Sep 17 00:00:00 2001 From: LeslieLeung Date: Sun, 26 Dec 2021 01:33:47 +0800 Subject: [PATCH 01/35] feat(*): support WeCom notification --- server/notification-providers/wecom.js | 47 ++++++++++++++++++++++++++ server/notification.js | 2 ++ src/components/notifications/WeCom.vue | 12 +++++++ src/components/notifications/index.js | 2 ++ 4 files changed, 63 insertions(+) create mode 100644 server/notification-providers/wecom.js create mode 100644 src/components/notifications/WeCom.vue diff --git a/server/notification-providers/wecom.js b/server/notification-providers/wecom.js new file mode 100644 index 000000000..7ba8c3783 --- /dev/null +++ b/server/notification-providers/wecom.js @@ -0,0 +1,47 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); +const { DOWN, UP } = require("../../src/util"); + +class WeCom extends NotificationProvider { + + name = "WeCom"; + + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + let okMsg = "Sent Successfully."; + + try { + let WeComUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=" + notification.weComBotKey; + let config = { + headers: { + "Content-Type": "application/json" + } + }; + let body = this.composeMessage(heartbeatJSON, msg); + await axios.post(WeComUrl, body, config); + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } + + composeMessage(heartbeatJSON, msg) { + let title; + if (msg != null && heartbeatJSON != null && heartbeatJSON['status'] == UP) { + title = "UptimeKuma Monitor Up"; + } + if (msg != null && heartbeatJSON != null && heartbeatJSON["status"] == DOWN) { + title = "UptimeKuma Monitor Down"; + } + if (msg != null) { + title = "UptimeKuma Message"; + } + return { + msgtype: "text", + text: { + content: title + msg + } + }; + } +} + +module.exports = WeCom; diff --git a/server/notification.js b/server/notification.js index 3eb5f97bf..868e11fa7 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 WeCom = require("./notification-providers/wecom"); class Notification { @@ -62,6 +63,7 @@ class Notification { new Bark(), new SerwerSMS(), new Stackfield(), + new WeCom(), ]; for (let item of list) { diff --git a/src/components/notifications/WeCom.vue b/src/components/notifications/WeCom.vue new file mode 100644 index 000000000..cef3708d1 --- /dev/null +++ b/src/components/notifications/WeCom.vue @@ -0,0 +1,12 @@ + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 155a1ab26..15cc09c7e 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 WeCom from "./WeCom.vue"; /** * Manage all notification form. @@ -57,6 +58,7 @@ const NotificationFormList = { "Bark": Bark, "serwersms": SerwerSMS, "stackfield": Stackfield, + "WeCom": WeCom, } export default NotificationFormList From 4005856ba662a825f5a069e35c5a00da49fe2671 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Mon, 27 Dec 2021 19:09:51 +0800 Subject: [PATCH 02/35] run build dist when building docker image --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 32c51176d..ad6436eca 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,12 @@ "jest-backend": "cross-env TEST_BACKEND=1 jest --config=./config/jest-backend.config.js", "tsc": "tsc", "vite-preview-dist": "vite preview --host --config ./config/vite.config.js", - "build-docker": "npm run build-docker-debian && npm run build-docker-alpine", + "build-docker": "npm run build && npm run build-docker-debian && npm run build-docker-alpine", "build-docker-alpine-base": "docker buildx build -f docker/alpine-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-alpine . --push", "build-docker-debian-base": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-debian . --push", "build-docker-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:1.11.1-alpine --target release . --push", "build-docker-debian": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.11.1 -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:1.11.1-debian --target release . --push", - "build-docker-nightly": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly --target nightly . --push", + "build-docker-nightly": "npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly --target nightly . --push", "build-docker-nightly-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly-alpine --target nightly . --push", "build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain", "upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain", From 69dfc0c0d2112216ad9421e6c29c52e7d9b7ca4b Mon Sep 17 00:00:00 2001 From: MrEddX <66828538+MrEddX@users.noreply.github.com> Date: Wed, 5 Jan 2022 08:15:34 +0200 Subject: [PATCH 03/35] Update bg-BG.js Fixed some typos. --- src/languages/bg-BG.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js index a731ad09a..e73abf846 100644 --- a/src/languages/bg-BG.js +++ b/src/languages/bg-BG.js @@ -131,8 +131,8 @@ export default { Events: "Събития", Heartbeats: "Проверки", "Auto Get": "Авт. попълване", - backupDescription: "Можете да архивирате всички монитори и всички известия в JSON файл.", - backupDescription2: "PS: Данни за история и събития не са включени.", + backupDescription: "Можете да архивирате всички монитори и всички известявания в JSON файл.", + backupDescription2: "PS: Имайте предвид, че данните за история и събития няма да бъдат включени.", backupDescription3: "Чувствителни данни, като токен кодове за известяване, се съдържат в експортирания файл. Моля, бъдете внимателни с неговото съхранение.", alertNoFile: "Моля, изберете файл за импортиране.", alertWrongFileType: "Моля, изберете JSON файл.", @@ -359,5 +359,5 @@ export default { smtpDkimPrivateKey: "Частен ключ", smtpDkimHashAlgo: "Хеш алгоритъм (по желание)", smtpDkimheaderFieldNames: "Хедър ключове за подписване (по желание)", - smtpDkimskipFields: "Хедър ключове, които да не се подписеат (по желание)", + smtpDkimskipFields: "Хедър ключове, които да не се подписват (по желание)", }; From 8f3ec3359110534cc0950e14ed04091a92e5ca63 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 5 Jan 2022 16:40:50 +0800 Subject: [PATCH 04/35] update to 1.11.2 --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ad6436eca..4cf0c03f0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uptime-kuma", - "version": "1.11.1", + "version": "1.11.2", "license": "MIT", "repository": { "type": "git", @@ -30,13 +30,13 @@ "build-docker": "npm run build && npm run build-docker-debian && npm run build-docker-alpine", "build-docker-alpine-base": "docker buildx build -f docker/alpine-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-alpine . --push", "build-docker-debian-base": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-debian . --push", - "build-docker-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:1.11.1-alpine --target release . --push", - "build-docker-debian": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.11.1 -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:1.11.1-debian --target release . --push", + "build-docker-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:1.11.2-alpine --target release . --push", + "build-docker-debian": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.11.2 -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:1.11.2-debian --target release . --push", "build-docker-nightly": "npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly --target nightly . --push", "build-docker-nightly-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly-alpine --target nightly . --push", "build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain", "upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain", - "setup": "git checkout 1.11.1 && npm ci --production && npm run download-dist", + "setup": "git checkout 1.11.2 && npm ci --production && npm run download-dist", "download-dist": "node extra/download-dist.js", "update-version": "node extra/update-version.js", "mark-as-nightly": "node extra/mark-as-nightly.js", From f8c5015e3f32a288b6a1a4b3f0be5712fd555e60 Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Wed, 5 Jan 2022 23:44:14 +0100 Subject: [PATCH 05/35] fix google chat type mismatch --- server/notification-providers/google-chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index 1610553c7..04c92623d 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -6,7 +6,7 @@ const { DOWN, UP } = require("../../src/util"); class GoogleChat extends NotificationProvider { - name = "Google Chat"; + name = "Google Chat (Google Workspace only)"; async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; From bcc3cec7d6ad12208e09a6686c1c960d16ad4204 Mon Sep 17 00:00:00 2001 From: Philipp Bischoff Date: Wed, 5 Jan 2022 23:57:40 +0100 Subject: [PATCH 06/35] extract translation for notification type --- server/notification-providers/google-chat.js | 2 +- src/components/notifications/index.js | 2 +- src/languages/de-DE.js | 1 + src/languages/en.js | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index 04c92623d..2dcd6e20a 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -6,7 +6,7 @@ const { DOWN, UP } = require("../../src/util"); class GoogleChat extends NotificationProvider { - name = "Google Chat (Google Workspace only)"; + name = "GoogleChat"; async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index be73d9ef8..03945f90e 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -60,7 +60,7 @@ const NotificationFormList = { "serwersms": SerwerSMS, "stackfield": Stackfield, "WeCom": WeCom, - "Google Chat (Google Workspace only)": GoogleChat + "GoogleChat": GoogleChat }; export default NotificationFormList; diff --git a/src/languages/de-DE.js b/src/languages/de-DE.js index 6c2dd1f19..48cdd2e3b 100644 --- a/src/languages/de-DE.js +++ b/src/languages/de-DE.js @@ -194,6 +194,7 @@ export default { promosms: "PromoSMS", lunasea: "LunaSea", apprise: "Apprise (Unterstützung für 50+ Benachrichtigungsdienste)", + GoogleChat: "Google Chat (nur Google Workspace)", pushbullet: "Pushbullet", line: "Line Messenger", mattermost: "Mattermost", diff --git a/src/languages/en.js b/src/languages/en.js index 80caba9a3..47513466c 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -243,6 +243,7 @@ export default { clicksendsms: "ClickSend SMS", lunasea: "LunaSea", apprise: "Apprise (Support 50+ Notification services)", + GoogleChat: "Google Chat (Google Workspace only)", pushbullet: "Pushbullet", line: "Line Messenger", mattermost: "Mattermost", From 64b3e04d3f8dbf65e25e94da960ab76c91a40336 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 6 Jan 2022 14:34:45 +0800 Subject: [PATCH 07/35] Fix #1129 --- server/notification-providers/smtp.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/notification-providers/smtp.js b/server/notification-providers/smtp.js index 1be68aeab..d85ee88c9 100644 --- a/server/notification-providers/smtp.js +++ b/server/notification-providers/smtp.js @@ -14,16 +14,20 @@ class SMTP extends NotificationProvider { secure: notification.smtpSecure, tls: { rejectUnauthorized: notification.smtpIgnoreTLSError || false, - }, - dkim: { + } + }; + + // Fix #1129 + if (notification.smtpDkimDomain) { + config.dkim = { domainName: notification.smtpDkimDomain, keySelector: notification.smtpDkimKeySelector, privateKey: notification.smtpDkimPrivateKey, hashAlgo: notification.smtpDkimHashAlgo, headerFieldNames: notification.smtpDkimheaderFieldNames, skipFields: notification.smtpDkimskipFields, - } - }; + }; + } // Should fix the issue in https://github.com/louislam/uptime-kuma/issues/26#issuecomment-896373904 if (notification.smtpUsername || notification.smtpPassword) { From ec5037f30d01f57ea9e0d0f38db68f0b53f879ca Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 6 Jan 2022 14:51:20 +0800 Subject: [PATCH 08/35] update to 1.11.3 --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4cf0c03f0..d101ef5d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uptime-kuma", - "version": "1.11.2", + "version": "1.11.3", "license": "MIT", "repository": { "type": "git", @@ -30,13 +30,13 @@ "build-docker": "npm run build && npm run build-docker-debian && npm run build-docker-alpine", "build-docker-alpine-base": "docker buildx build -f docker/alpine-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-alpine . --push", "build-docker-debian-base": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-debian . --push", - "build-docker-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:1.11.2-alpine --target release . --push", - "build-docker-debian": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.11.2 -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:1.11.2-debian --target release . --push", + "build-docker-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:1.11.3-alpine --target release . --push", + "build-docker-debian": "docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.11.3 -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:1.11.3-debian --target release . --push", "build-docker-nightly": "npm run build && docker buildx build -f docker/dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly --target nightly . --push", "build-docker-nightly-alpine": "docker buildx build -f docker/dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly-alpine --target nightly . --push", "build-docker-nightly-amd64": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:nightly-amd64 --target nightly . --push --progress plain", "upload-artifacts": "docker buildx build -f docker/dockerfile --platform linux/amd64 -t louislam/uptime-kuma:upload-artifact --build-arg VERSION --build-arg GITHUB_TOKEN --target upload-artifact . --progress plain", - "setup": "git checkout 1.11.2 && npm ci --production && npm run download-dist", + "setup": "git checkout 1.11.3 && npm ci --production && npm run download-dist", "download-dist": "node extra/download-dist.js", "update-version": "node extra/update-version.js", "mark-as-nightly": "node extra/mark-as-nightly.js", From 46fa6a56fa79c3ce793dcb73cd73b8be8fdfb0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=89VEIL?= Date: Thu, 6 Jan 2022 08:48:12 +0100 Subject: [PATCH 09/35] fix `TypeError: Cannot read property 'id' of null` when testing a Google Chat notification see https://github.com/louislam/uptime-kuma/issues/1126#issuecomment-1006343423 --- server/notification-providers/google-chat.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/notification-providers/google-chat.js b/server/notification-providers/google-chat.js index 2dcd6e20a..6fb324288 100644 --- a/server/notification-providers/google-chat.js +++ b/server/notification-providers/google-chat.js @@ -27,7 +27,7 @@ class GoogleChat extends NotificationProvider { textMsg += `${msg}`; const baseURL = await setting("primaryBaseURL"); - if (baseURL) { + if (baseURL && monitorJSON) { textMsg += `\n${baseURL + getMonitorRelativeURL(monitorJSON.id)}`; } From 2304c53c8d4801076c341455437a8ecf7a77b755 Mon Sep 17 00:00:00 2001 From: Matteo D Date: Sat, 8 Jan 2022 13:28:48 +0100 Subject: [PATCH 10/35] Fixed some translations And made them more user-friendly. --- src/components/settings/Security.vue | 6 +- src/languages/it-IT.js | 155 ++++++++++++++------------- 2 files changed, 81 insertions(+), 80 deletions(-) diff --git a/src/components/settings/Security.vue b/src/components/settings/Security.vue index c94c39158..94c6b5a67 100644 --- a/src/components/settings/Security.vue +++ b/src/components/settings/Security.vue @@ -175,9 +175,9 @@