diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 916a4b934..6b37b5d85 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -127,7 +127,7 @@ Different guidelines exist for different types of pull requests (PRs): - `server/monitor-types/MONITORING_TYPE.js` is the core of each monitor. the `async check(...)`-function should: - throw an error for each fault that is detected with an actionable error message - - in the happy-path, you should set `heartbeat.msg` to a successfull message and set `heartbeat.status = UP` + - in the happy-path, you should set `heartbeat.msg` to a successful message and set `heartbeat.status = UP` - `server/uptime-kuma-server.js` is where the monitoring backend needs to be registered. *If you have an idea how we can skip this step, we would love to hear about it ^^* - `src/pages/EditMonitor.vue` is the shared frontend users interact with. diff --git a/server/model/status_page.js b/server/model/status_page.js index 528d1dd49..e40b28f6f 100644 --- a/server/model/status_page.js +++ b/server/model/status_page.js @@ -4,6 +4,7 @@ const cheerio = require("cheerio"); const { UptimeKumaServer } = require("../uptime-kuma-server"); const jsesc = require("jsesc"); const googleAnalytics = require("../google-analytics"); +const { marked } = require("marked"); class StatusPage extends BeanModel { @@ -46,7 +47,11 @@ class StatusPage extends BeanModel { */ static async renderHTML(indexHTML, statusPage) { const $ = cheerio.load(indexHTML); - const description155 = statusPage.description?.substring(0, 155) ?? ""; + + const description155 = marked(statusPage.description ?? "") + .replace(/<[^>]+>/gm, "") + .trim() + .substring(0, 155); $("title").text(statusPage.title); $("meta[name=description]").attr("content", description155); diff --git a/server/notification-providers/onesender.js b/server/notification-providers/onesender.js new file mode 100644 index 000000000..4a33931a2 --- /dev/null +++ b/server/notification-providers/onesender.js @@ -0,0 +1,47 @@ +const NotificationProvider = require("./notification-provider"); +const axios = require("axios"); + +class Onesender extends NotificationProvider { + name = "Onesender"; + + /** + * @inheritdoc + */ + async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { + const okMsg = "Sent Successfully."; + + try { + let data = { + heartbeat: heartbeatJSON, + monitor: monitorJSON, + msg, + to: notification.onesenderReceiver, + type: "text", + recipient_type: "individual", + text: { + body: msg + } + }; + if (notification.onesenderTypeReceiver === "private") { + data.to = notification.onesenderReceiver + "@s.whatsapp.net"; + } else { + data.recipient_type = "group"; + data.to = notification.onesenderReceiver + "@g.us"; + } + let config = { + headers: { + "Authorization": "Bearer " + notification.onesenderToken, + } + }; + await axios.post(notification.onesenderURL, data, config); + return okMsg; + + } catch (error) { + this.throwGeneralAxiosError(error); + } + + } + +} + +module.exports = Onesender; diff --git a/server/notification.js b/server/notification.js index 28b0db758..e6a2e6d5e 100644 --- a/server/notification.js +++ b/server/notification.js @@ -64,6 +64,7 @@ const SevenIO = require("./notification-providers/sevenio"); const Whapi = require("./notification-providers/whapi"); const GtxMessaging = require("./notification-providers/gtx-messaging"); const Cellsynt = require("./notification-providers/cellsynt"); +const Onesender = require("./notification-providers/onesender"); class Notification { @@ -111,6 +112,7 @@ class Notification { new Ntfy(), new Octopush(), new OneBot(), + new Onesender(), new Opsgenie(), new PagerDuty(), new FlashDuty(), diff --git a/src/assets/app.scss b/src/assets/app.scss index c7e56ba74..28eeca87c 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss @@ -576,6 +576,12 @@ optgroup { outline: none !important; } +.prism-editor__container { + .important { + font-weight: var(--bs-body-font-weight) !important; + } +} + h5.settings-subheading::after { content: ""; display: block; diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 427366619..288b00559 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -135,6 +135,7 @@ export default { "ntfy": "Ntfy", "octopush": "Octopush", "OneBot": "OneBot", + "Onesender": "Onesender", "Opsgenie": "Opsgenie", "PagerDuty": "PagerDuty", "PagerTree": "PagerTree", diff --git a/src/components/notifications/Onesender.vue b/src/components/notifications/Onesender.vue new file mode 100644 index 000000000..81dbe7f0a --- /dev/null +++ b/src/components/notifications/Onesender.vue @@ -0,0 +1,81 @@ + + + + + diff --git a/src/components/notifications/index.js b/src/components/notifications/index.js index 5d49b8a4a..51642d7da 100644 --- a/src/components/notifications/index.js +++ b/src/components/notifications/index.js @@ -29,6 +29,7 @@ import Nostr from "./Nostr.vue"; import Ntfy from "./Ntfy.vue"; import Octopush from "./Octopush.vue"; import OneBot from "./OneBot.vue"; +import Onesender from "./Onesender.vue"; import Opsgenie from "./Opsgenie.vue"; import PagerDuty from "./PagerDuty.vue"; import FlashDuty from "./FlashDuty.vue"; @@ -98,6 +99,7 @@ const NotificationFormList = { "ntfy": Ntfy, "octopush": Octopush, "OneBot": OneBot, + "Onesender": Onesender, "Opsgenie": Opsgenie, "PagerDuty": PagerDuty, "FlashDuty": FlashDuty, diff --git a/src/lang/en.json b/src/lang/en.json index 7cb663b69..1382707d5 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -962,5 +962,13 @@ "threemaSenderIdentityFormat": "8 characters, usually starts with *", "threemaApiAuthenticationSecret": "Gateway-ID Secret", "threemaBasicModeInfo": "Note: This integration uses Threema Gateway in basic mode (server-based encryption). Further details can be found {0}.", - "apiKeysDisabledMsg": "API keys are disabled because authentication is disabled." + "apiKeysDisabledMsg": "API keys are disabled because authentication is disabled.", + "Host Onesender": "Host Onesender", + "Token Onesender": "Token Onesender", + "Recipient Type": "Recipient Type", + "Private Number": "Private Number", + "privateOnesenderDesc": "Make sure the number phone is valid. To send message into private number phone, ex: 628123456789", + "groupOnesenderDesc": "Make sure the GroupID is valid. To send message into Group, ex: 628123456789-342345", + "Group ID": "Group ID", + "wayToGetOnesenderUrlandToken":"You can get the URL and Token by going to the Onesender website. More info {0}" }