From 60b44c2cddc37e8995b22ad8308e8e4f54bfdcce Mon Sep 17 00:00:00 2001 From: MrEddX <66828538+MrEddX@users.noreply.github.com> Date: Fri, 25 Mar 2022 07:31:26 +0200 Subject: [PATCH 01/13] Update bg-BG.js Fixed translation. --- src/languages/bg-BG.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/bg-BG.js b/src/languages/bg-BG.js index 4dd79bfc7..787db0b24 100644 --- a/src/languages/bg-BG.js +++ b/src/languages/bg-BG.js @@ -343,7 +343,7 @@ export default { "No Monitors": "Няма монитори", "Untitled Group": "Група без заглавие", Services: "Услуги", - Discard: "Премахни", + Discard: "Отмени", Cancel: "Отмени", "Powered by": "Създадено чрез", serwersms: "SerwerSMS.pl", From 0a5db0cecbadc01d88bb0e8dff5cc10e9b77580e Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 14 Apr 2022 10:12:03 +0800 Subject: [PATCH 02/13] Fix #1478 --- server/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/server.js b/server/server.js index 109221e2d..ced5626c8 100644 --- a/server/server.js +++ b/server/server.js @@ -1228,7 +1228,7 @@ try { } // Only starts importing if the backup file contains at least one proxy - if (proxyListData.length >= 1) { + if (proxyListData && proxyListData.length >= 1) { const proxies = await R.findAll("proxy"); // Loop over proxy list and save proxies From 4656ab3d5784139ed90ea04ec53ff38989baa54d Mon Sep 17 00:00:00 2001 From: ColdThunder11 Date: Fri, 28 Jan 2022 15:02:28 +0800 Subject: [PATCH 03/13] Add OneBot notification service --- server/notification-providers/onebot.js | 45 +++++++++++++++++++++++++ server/notification.js | 3 ++ src/components/notifications/OneBot.vue | 34 +++++++++++++++++++ src/components/notifications/index.js | 2 ++ src/languages/en.js | 6 ++++ src/languages/zh-CN.js | 6 ++++ 6 files changed, 96 insertions(+) create mode 100644 server/notification-providers/onebot.js create mode 100644 src/components/notifications/OneBot.vue diff --git a/server/notification-providers/onebot.js b/server/notification-providers/onebot.js new file mode 100644 index 000000000..0359e83aa --- /dev/null +++ b/server/notification-providers/onebot.js @@ -0,0 +1,45 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class OneBot extends NotificationProvider { + + name = "OneBot"; + + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + let okMsg = "Sent Successfully."; + try { + let httpAddr = notification.httpAddr; + if (!httpAddr.startsWith("http")) { + httpAddr = "http://" + httpAddr; + } + if (!httpAddr.endsWith("/")) { + httpAddr += "/"; + } + let onebotAPIUrl = httpAddr + "send_msg"; + let config = { + headers: { + "Content-Type": "application/json", + "Authorization": "Bearer " + notification.accessToken + } + }; + let psuhText = "UptimeKuma Alert: " + msg; + let data = { + "auto_escape": true, + "message": psuhText + }; + if (notification.msgType == "group") { + data["message_type"] = "group"; + data["group_id"] = notification.recieverId; + } else { + data["message_type"] = "private"; + data["user_id"] = notification.recieverId; + } + await axios.post(onebotAPIUrl, data, config); + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = OneBot; diff --git a/server/notification.js b/server/notification.js index 359e4c9ec..88cfb8900 100644 --- a/server/notification.js +++ b/server/notification.js @@ -31,6 +31,7 @@ const WeCom = require("./notification-providers/wecom"); const GoogleChat = require("./notification-providers/google-chat"); const Gorush = require("./notification-providers/gorush"); const Alerta = require("./notification-providers/alerta"); +const Onebot = require("./notification-providers/onebot"); class Notification { @@ -73,6 +74,8 @@ class Notification { new GoogleChat(), new Gorush(), new Alerta(), + new GoogleChat(), + new Onebot(), ]; for (let item of list) { diff --git a/src/components/notifications/OneBot.vue b/src/components/notifications/OneBot.vue new file mode 100644 index 000000000..63604d60f --- /dev/null +++ b/src/components/notifications/OneBot.vue @@ -0,0 +1,34 @@ + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 455b82622..2fa36c0f4 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -29,6 +29,7 @@ import WeCom from "./WeCom.vue"; import GoogleChat from "./GoogleChat.vue"; import Gorush from "./Gorush.vue"; import Alerta from "./Alerta.vue"; +import OneBot from "./OneBot.vue"; /** * Manage all notification form. @@ -67,6 +68,7 @@ const NotificationFormList = { "GoogleChat": GoogleChat, "gorush": Gorush, "alerta": Alerta, + "OneBot": OneBot, }; export default NotificationFormList; diff --git a/src/languages/en.js b/src/languages/en.js index ac432ba9a..2dcec68cc 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -445,4 +445,10 @@ export default { "Domain Name Expiry Notification": "Domain Name Expiry Notification", "Proxy": "Proxy", "Date Created": "Date Created", + onebotHttpAddress: "OneBot HTTP Address", + onebotMessageType: "OneBot Message Type", + onebotGroupMessage: "Group", + onebotPrivateMessage: "Private", + onebotUserOrGroupId: "Group/User ID", + onebotSafetyTips: "For safety, must set access token", }; diff --git a/src/languages/zh-CN.js b/src/languages/zh-CN.js index ba1132a3c..2f2d9f2b4 100644 --- a/src/languages/zh-CN.js +++ b/src/languages/zh-CN.js @@ -452,4 +452,10 @@ export default { "Domain Name Expiry Notification": "域名到期时通知", "Proxy": "代理", "Date Created": "创建于", + onebotHttpAddress: "OneBot HTTP 地址", + onebotMessageType: "OneBot 消息类型", + onebotGroupMessage: "群聊", + onebotPrivateMessage: "私聊", + onebotUserOrGroupId: "群组/用户ID", + onebotSafetyTips: "出于安全原因,请务必设置AccessToken", }; From bd9df09f8765db212eee5b34e309e1a058e80fa5 Mon Sep 17 00:00:00 2001 From: ColdThunder11 <34985592+ColdThunder11@users.noreply.github.com> Date: Wed, 2 Feb 2022 21:37:09 +0800 Subject: [PATCH 04/13] Apply suggestions from code review, fix style Co-authored-by: Adam Stachowicz --- server/notification-providers/onebot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/notification-providers/onebot.js b/server/notification-providers/onebot.js index 0359e83aa..a01cf99a3 100644 --- a/server/notification-providers/onebot.js +++ b/server/notification-providers/onebot.js @@ -19,13 +19,13 @@ class OneBot extends NotificationProvider { let config = { headers: { "Content-Type": "application/json", - "Authorization": "Bearer " + notification.accessToken + "Authorization": "Bearer " + notification.accessToken, } }; let psuhText = "UptimeKuma Alert: " + msg; let data = { "auto_escape": true, - "message": psuhText + "message": psuhText, }; if (notification.msgType == "group") { data["message_type"] = "group"; From ddf8a7a692000a9bf9d21a7b6a399a97f46c8f36 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 14 Apr 2022 10:43:59 +0800 Subject: [PATCH 05/13] Fix camelCase --- server/notification.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/notification.js b/server/notification.js index 88cfb8900..8783a7cdd 100644 --- a/server/notification.js +++ b/server/notification.js @@ -31,7 +31,7 @@ const WeCom = require("./notification-providers/wecom"); const GoogleChat = require("./notification-providers/google-chat"); const Gorush = require("./notification-providers/gorush"); const Alerta = require("./notification-providers/alerta"); -const Onebot = require("./notification-providers/onebot"); +const OneBot = require("./notification-providers/onebot"); class Notification { @@ -75,7 +75,7 @@ class Notification { new Gorush(), new Alerta(), new GoogleChat(), - new Onebot(), + new OneBot(), ]; for (let item of list) { From d0b5f147e23d10f3281599ecadac39a7228ed6c2 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 14 Apr 2022 10:55:41 +0800 Subject: [PATCH 06/13] Fix spelling and merge mistake --- server/notification-providers/onebot.js | 4 ++-- server/notification.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/notification-providers/onebot.js b/server/notification-providers/onebot.js index a01cf99a3..c08cc01e8 100644 --- a/server/notification-providers/onebot.js +++ b/server/notification-providers/onebot.js @@ -22,10 +22,10 @@ class OneBot extends NotificationProvider { "Authorization": "Bearer " + notification.accessToken, } }; - let psuhText = "UptimeKuma Alert: " + msg; + let pushText = "UptimeKuma Alert: " + msg; let data = { "auto_escape": true, - "message": psuhText, + "message": pushText, }; if (notification.msgType == "group") { data["message_type"] = "group"; diff --git a/server/notification.js b/server/notification.js index 8783a7cdd..a83a8cdce 100644 --- a/server/notification.js +++ b/server/notification.js @@ -74,7 +74,6 @@ class Notification { new GoogleChat(), new Gorush(), new Alerta(), - new GoogleChat(), new OneBot(), ]; From 03dd02fd38b00fc79d15b6f0968b6f3607f93b10 Mon Sep 17 00:00:00 2001 From: sovushik <30425777+sovushik@users.noreply.github.com> Date: Mon, 4 Apr 2022 11:55:54 +0500 Subject: [PATCH 07/13] Update ru-RU.js Add RU for 1.14 version --- src/languages/ru-RU.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/languages/ru-RU.js b/src/languages/ru-RU.js index c8212442b..056e36071 100644 --- a/src/languages/ru-RU.js +++ b/src/languages/ru-RU.js @@ -389,4 +389,12 @@ export default { alertaApiKey: "Ключ API", alertaAlertState: "Состояние алерта", alertaRecoverState: "Состояние восстановления", + Proxies: "Прокси", + default: "По умолчанию", + enabled: "Включено", + setAsDefault: "Установить по умолчанию", + deleteProxyMsg: "Вы действительно хотите удалить этот прокси для всех мониторов?", + proxyDescription: "Для работы прокси следует назначит его одному из мониторов", + enableProxyDescription: "Этот прокси не будет влиять на запросы мониторинга, пока он не будет активирован. Вы можете контролировать временное отключение прокси со всех мониторов по статусу активации.", + setAsDefaultProxyDescription: "Этот прокси был активирован по умолчанию для новых мониторов. Вы можете отключить прокси для каждого отдельного монитора.", }; From fd8cba1dad83912284d56f7524815f7946e88940 Mon Sep 17 00:00:00 2001 From: DX37 Date: Mon, 4 Apr 2022 22:03:44 +0700 Subject: [PATCH 08/13] nudge nodemailer strings; translate new ones --- src/languages/ru-RU.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/languages/ru-RU.js b/src/languages/ru-RU.js index 056e36071..5e889e52d 100644 --- a/src/languages/ru-RU.js +++ b/src/languages/ru-RU.js @@ -374,8 +374,8 @@ export default { serwersmsSenderName: "SMS Имя Отправителя (регистрированный через пользовательский портал)", stackfield: "Stackfield", smtpDkimSettings: "DKIM Настройки", - smtpDkimDesc: "Please refer to the Nodemailer DKIM {0} for usage.", - documentation: "документация", + smtpDkimDesc: "Пожалуйста ознакомьтесь с {0} Nodemailer DKIM для использования.", + documentation: "документацией", smtpDkimDomain: "Имя Домена", smtpDkimKeySelector: "Ключ", smtpDkimPrivateKey: "Приватный ключ", @@ -392,9 +392,9 @@ export default { Proxies: "Прокси", default: "По умолчанию", enabled: "Включено", - setAsDefault: "Установить по умолчанию", + setAsDefault: "Установлено по умолчанию", deleteProxyMsg: "Вы действительно хотите удалить этот прокси для всех мониторов?", - proxyDescription: "Для работы прокси следует назначит его одному из мониторов", - enableProxyDescription: "Этот прокси не будет влиять на запросы мониторинга, пока он не будет активирован. Вы можете контролировать временное отключение прокси со всех мониторов по статусу активации.", - setAsDefaultProxyDescription: "Этот прокси был активирован по умолчанию для новых мониторов. Вы можете отключить прокси для каждого отдельного монитора.", + proxyDescription: "Прокси должны быть привязаны к монитору, чтобы работать.", + enableProxyDescription: "Этот прокси не будет влиять на запросы монитора, пока не будет активирован. Вы можете контролировать временное отключение прокси для всех мониторов через статус активации.", + setAsDefaultProxyDescription: "Этот прокси будет по умолчанию включен для новых мониторов. Вы всё ещё можете отдельно отключать прокси в каждом мониторе.", }; From e44699216ee21c1d052d64b27273a28771fea00f Mon Sep 17 00:00:00 2001 From: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com> Date: Wed, 13 Apr 2022 13:54:53 +0200 Subject: [PATCH 09/13] Fix readability of chart hover --- src/components/PingChart.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/PingChart.vue b/src/components/PingChart.vue index 50d510422..d5f80a379 100644 --- a/src/components/PingChart.vue +++ b/src/components/PingChart.vue @@ -286,6 +286,7 @@ export default { .dark &:hover { background: $dark-font-color; + color: black; } } From 2e3414135fbf8fbe47ee7fe1adbdfc8a20958dac Mon Sep 17 00:00:00 2001 From: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com> Date: Wed, 13 Apr 2022 20:17:15 +0200 Subject: [PATCH 10/13] Update src/components/PingChart.vue Co-authored-by: Matthew Nickson --- src/components/PingChart.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PingChart.vue b/src/components/PingChart.vue index d5f80a379..4ff4c708f 100644 --- a/src/components/PingChart.vue +++ b/src/components/PingChart.vue @@ -286,7 +286,7 @@ export default { .dark &:hover { background: $dark-font-color; - color: black; + color: $dark-font-color2; } } From fb059f5e91bbe8ef97cc9107b3af6996b82e4b0d Mon Sep 17 00:00:00 2001 From: ngc7331 Date: Sat, 2 Apr 2022 14:40:33 +0800 Subject: [PATCH 11/13] Add support for Pushdeer notifications --- server/notification-providers/pushdeer.js | 52 +++++++++++++++++++++++ server/notification.js | 2 + src/components/notifications/Pushdeer.vue | 19 +++++++++ src/components/notifications/index.js | 2 + 4 files changed, 75 insertions(+) create mode 100644 server/notification-providers/pushdeer.js create mode 100644 src/components/notifications/Pushdeer.vue diff --git a/server/notification-providers/pushdeer.js b/server/notification-providers/pushdeer.js new file mode 100644 index 000000000..f86577693 --- /dev/null +++ b/server/notification-providers/pushdeer.js @@ -0,0 +1,52 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); +const { DOWN, UP } = require("../../src/util"); + +class Pushdeer extends NotificationProvider { + + name = "Pushdeer"; + + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + let okMsg = "Sent Successfully."; + let pushdeerlink = "https://api2.pushdeer.com/message/push"; + + let valid = msg != null && monitorJSON != null && heartbeatJSON != null; + + let title; + if (valid && heartbeatJSON.status == UP) { + title = "## UptimeKuma: " + monitorJSON.name + " up"; + } else if (valid && heartbeatJSON.status == DOWN) { + title = "## UptimeKuma: " + monitorJSON.name + " down"; + } else { + title = "## UptimeKuma Message"; + } + + let data = { + "pushkey": notification.pushdeerKey, + "text": title, + "desp": msg.replace(/\n/g, "\n\n"), + "type": "markdown", + }; + + try { + let res = await axios.post(pushdeerlink, data); + + if ("error" in res.data) { + let error = res.data.error; + this.throwGeneralAxiosError(error); + } + if (res.data.content.result.length === 0) { + let error = "Invalid Pushdeer key"; + this.throwGeneralAxiosError(error); + } else if (JSON.parse(res.data.content.result[0]).success != "ok") { + let error = "Unknown error"; + this.throwGeneralAxiosError(error); + } + return okMsg; + } catch (error) { + this.throwGeneralAxiosError(error); + } + } +} + +module.exports = Pushdeer; diff --git a/server/notification.js b/server/notification.js index a83a8cdce..e3d37bafb 100644 --- a/server/notification.js +++ b/server/notification.js @@ -32,6 +32,7 @@ const GoogleChat = require("./notification-providers/google-chat"); const Gorush = require("./notification-providers/gorush"); const Alerta = require("./notification-providers/alerta"); const OneBot = require("./notification-providers/onebot"); +const Pushdeer = require("./notification-providers/pushdeer"); class Notification { @@ -75,6 +76,7 @@ class Notification { new Gorush(), new Alerta(), new OneBot(), + new Pushdeer(), ]; for (let item of list) { diff --git a/src/components/notifications/Pushdeer.vue b/src/components/notifications/Pushdeer.vue new file mode 100644 index 000000000..762715504 --- /dev/null +++ b/src/components/notifications/Pushdeer.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 2fa36c0f4..2a7d77933 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -30,6 +30,7 @@ import GoogleChat from "./GoogleChat.vue"; import Gorush from "./Gorush.vue"; import Alerta from "./Alerta.vue"; import OneBot from "./OneBot.vue"; +import Pushdeer from "./Pushdeer.vue"; /** * Manage all notification form. @@ -69,6 +70,7 @@ const NotificationFormList = { "gorush": Gorush, "alerta": Alerta, "OneBot": OneBot, + "Pushdeer": Pushdeer, }; export default NotificationFormList; From 93c51504f93d7828674f797f06e24d3a3fcd9b95 Mon Sep 17 00:00:00 2001 From: ngc7331 Date: Wed, 6 Apr 2022 08:38:48 +0800 Subject: [PATCH 12/13] fixes: formatting and security issues Co-authored-by: Matthew Nickson --- server/notification-providers/pushdeer.js | 6 +++--- src/components/notifications/Pushdeer.vue | 6 +++--- src/languages/en.js | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/server/notification-providers/pushdeer.js b/server/notification-providers/pushdeer.js index f86577693..6831b8cce 100644 --- a/server/notification-providers/pushdeer.js +++ b/server/notification-providers/pushdeer.js @@ -14,11 +14,11 @@ class Pushdeer extends NotificationProvider { let title; if (valid && heartbeatJSON.status == UP) { - title = "## UptimeKuma: " + monitorJSON.name + " up"; + title = "## Uptime Kuma: " + monitorJSON.name + " up"; } else if (valid && heartbeatJSON.status == DOWN) { - title = "## UptimeKuma: " + monitorJSON.name + " down"; + title = "## Uptime Kuma: " + monitorJSON.name + " down"; } else { - title = "## UptimeKuma Message"; + title = "## Uptime Kuma Message"; } let data = { diff --git a/src/components/notifications/Pushdeer.vue b/src/components/notifications/Pushdeer.vue index 762715504..80d0f48ff 100644 --- a/src/components/notifications/Pushdeer.vue +++ b/src/components/notifications/Pushdeer.vue @@ -1,11 +1,11 @@ @@ -16,4 +16,4 @@ export default { HiddenInput, }, }; - \ No newline at end of file + diff --git a/src/languages/en.js b/src/languages/en.js index 2dcec68cc..f432a9c46 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -451,4 +451,5 @@ export default { onebotPrivateMessage: "Private", onebotUserOrGroupId: "Group/User ID", onebotSafetyTips: "For safety, must set access token", + "Pushdeer Key": "Pushdeer Key", }; From fb0064082ee4a301e3c1afb969e347cfd9600878 Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 14 Apr 2022 14:29:54 +0800 Subject: [PATCH 13/13] Change Pushdeer to PushDeer --- server/notification-providers/pushdeer.js | 8 ++++---- server/notification.js | 4 ++-- .../notifications/{Pushdeer.vue => PushDeer.vue} | 2 +- src/components/notifications/index.js | 4 ++-- src/languages/en.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename src/components/notifications/{Pushdeer.vue => PushDeer.vue} (96%) diff --git a/server/notification-providers/pushdeer.js b/server/notification-providers/pushdeer.js index 6831b8cce..620c1b20a 100644 --- a/server/notification-providers/pushdeer.js +++ b/server/notification-providers/pushdeer.js @@ -2,9 +2,9 @@ const NotificationProvider = require("./notification-provider"); const axios = require("axios"); const { DOWN, UP } = require("../../src/util"); -class Pushdeer extends NotificationProvider { +class PushDeer extends NotificationProvider { - name = "Pushdeer"; + name = "PushDeer"; async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { let okMsg = "Sent Successfully."; @@ -36,7 +36,7 @@ class Pushdeer extends NotificationProvider { this.throwGeneralAxiosError(error); } if (res.data.content.result.length === 0) { - let error = "Invalid Pushdeer key"; + let error = "Invalid PushDeer key"; this.throwGeneralAxiosError(error); } else if (JSON.parse(res.data.content.result[0]).success != "ok") { let error = "Unknown error"; @@ -49,4 +49,4 @@ class Pushdeer extends NotificationProvider { } } -module.exports = Pushdeer; +module.exports = PushDeer; diff --git a/server/notification.js b/server/notification.js index e3d37bafb..842e0e2f8 100644 --- a/server/notification.js +++ b/server/notification.js @@ -32,7 +32,7 @@ const GoogleChat = require("./notification-providers/google-chat"); const Gorush = require("./notification-providers/gorush"); const Alerta = require("./notification-providers/alerta"); const OneBot = require("./notification-providers/onebot"); -const Pushdeer = require("./notification-providers/pushdeer"); +const PushDeer = require("./notification-providers/pushdeer"); class Notification { @@ -76,7 +76,7 @@ class Notification { new Gorush(), new Alerta(), new OneBot(), - new Pushdeer(), + new PushDeer(), ]; for (let item of list) { diff --git a/src/components/notifications/Pushdeer.vue b/src/components/notifications/PushDeer.vue similarity index 96% rename from src/components/notifications/Pushdeer.vue rename to src/components/notifications/PushDeer.vue index 80d0f48ff..c2b7f5cb0 100644 --- a/src/components/notifications/Pushdeer.vue +++ b/src/components/notifications/PushDeer.vue @@ -1,6 +1,6 @@