diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69f98c0e4..2e10be48c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Project Info -First of all, I want to thank everyone who have wrote issues or shared pull requests for Uptime Kuma. +First of all, I want to thank everyone who has submitted issues or shared pull requests for Uptime Kuma. I never thought the GitHub community would be so nice! Because of this, I also never thought that other people would actually read and edit my code. Parts of the code are not very well-structured or commented, sorry about that. @@ -9,7 +9,7 @@ The project was created with `vite.js` and is written in `vue3`. Our backend lives in the `server`-directory and mostly communicates via websockets. Both frontend and backend share the same `package.json`. -For production, the frontend is build into `dist`-directory and the server (`express.js`) exposes the `dist` directory as the root of the endpoint. +For production, the frontend is built into the `dist`-directory and the server (`express.js`) exposes the `dist` directory as the root of the endpoint. For development, we run vite in development mode on another port. ## Directories @@ -28,7 +28,7 @@ For development, we run vite in development mode on another port. ## Can I create a pull request for Uptime Kuma? Yes or no, it depends on what you will try to do. -Both your and our maintainers time is precious, and we don't want to waste both time. +Both yours and our maintainers' time is precious, and we don't want to waste either. If you have any questions about any process/.. is not clear, you are likely not alone => please ask them ^^ @@ -49,11 +49,11 @@ Different guidelines exist for different types of pull requests (PRs):

If you come across a bug and think you can solve, we appreciate your work. - Please make sure that you follow by these rules: + Please make sure that you follow these rules: - keep the PR as small as possible, fix only one thing at a time => keeping it reviewable - - test that your code does what you came it does. + - test that your code does what you claim it does. - Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area. + Because maintainer time is precious, junior maintainers may merge uncontroversial PRs in this area.

-
translations / internationalisation (i18n) @@ -68,7 +68,7 @@ Different guidelines exist for different types of pull requests (PRs): - language keys need to be **added to `en.json`** to be visible in weblate. If this has not happened, a PR is appreciated. - **Adding a new language** requires a new file see [these instructions](https://github.com/louislam/uptime-kuma/blob/master/src/lang/README.md) - Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area. + Because maintainer time is precious, junior maintainers may merge uncontroversial PRs in this area.

-
new notification providers @@ -102,7 +102,7 @@ Different guidelines exist for different types of pull requests (PRs): Therefore, making sure that they work is also really important. Because testing notification providers is quite time intensive, we mostly offload this onto the person contributing a notification provider. - To make shure you have tested the notification provider, please include screenshots of the following events in the pull-request description: + To make sure you have tested the notification provider, please include screenshots of the following events in the pull-request description: - `UP`/`DOWN` - Certificate Expiry via https://expired.badssl.com/ - Testing (the test button on the notification provider setup page) @@ -117,7 +117,7 @@ Different guidelines exist for different types of pull requests (PRs): | Testing | paste-image-here | paste-image-here | ``` - Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area. + Because maintainer time is precious, junior maintainers may merge uncontroversial PRs in this area.

-
new monitoring types @@ -138,14 +138,14 @@ Different guidelines exist for different types of pull requests (PRs): - - Because maintainer time is precious junior maintainers may merge uncontroversial PRs in this area. + Because maintainer time is precious, junior maintainers may merge uncontroversial PRs in this area.

-
new features/ major changes / breaking bugfixes

be sure to **create an empty draft pull request or open an issue, so we can have a discussion first**. - This is especially important for a large pull request or you don't know if it will be merged or not. + This is especially important for a large pull request or when you don't know if it will be merged or not. Because of the large impact of this work, only senior maintainers may merge PRs in this area.

@@ -201,7 +201,7 @@ The rationale behind this is that we can align the direction and scope of the fe ## Project Styles -I personally do not like something that requires so many configurations before you can finally start the app. +I personally do not like something that requires a lot of configuration before you can finally start the app. The goal is to make the Uptime Kuma installation as easy as installing a mobile app. - Easy to install for non-Docker users @@ -260,7 +260,7 @@ Port `3000` and port `3001` will be used. npm run dev ``` -But sometimes, you would like to restart the server, but not the frontend, you can run these commands in two terminals: +But sometimes you may want to restart the server without restarting the frontend. In that case, you can run these commands in two terminals: ```bash npm run start-frontend-dev @@ -409,7 +409,7 @@ https://github.com/louislam/uptime-kuma/issues?q=sort%3Aupdated-desc ### What is a maintainer and what are their roles? -This project has multiple maintainers which specialise in different areas. +This project has multiple maintainers who specialise in different areas. Currently, there are 3 maintainers: | Person | Role | Main Area | diff --git a/server/notification-providers/dingding.js b/server/notification-providers/dingding.js index 5d8cb8948..c66f270a7 100644 --- a/server/notification-providers/dingding.js +++ b/server/notification-providers/dingding.js @@ -87,7 +87,6 @@ class DingDing extends NotificationProvider { * @returns {string} Status */ statusToString(status) { - // TODO: Move to notification-provider.js to avoid repetition in classes switch (status) { case DOWN: return "DOWN"; diff --git a/server/notification-providers/discord.js b/server/notification-providers/discord.js index ccb80bf40..6a52f8f3e 100644 --- a/server/notification-providers/discord.js +++ b/server/notification-providers/discord.js @@ -48,7 +48,7 @@ class Discord extends NotificationProvider { }, { name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: this.extractAdress(monitorJSON), + value: this.extractAddress(monitorJSON), }, { name: `Time (${heartbeatJSON["timezone"]})`, @@ -85,7 +85,7 @@ class Discord extends NotificationProvider { }, { name: monitorJSON["type"] === "push" ? "Service Type" : "Service URL", - value: this.extractAdress(monitorJSON), + value: this.extractAddress(monitorJSON), }, { name: `Time (${heartbeatJSON["timezone"]})`, diff --git a/server/notification-providers/notification-provider.js b/server/notification-providers/notification-provider.js index d26b791f6..b9fb3d863 100644 --- a/server/notification-providers/notification-provider.js +++ b/server/notification-providers/notification-provider.js @@ -24,7 +24,7 @@ class NotificationProvider { * @param {?object} monitorJSON Monitor details (For Up/Down only) * @returns {string} The extracted address based on the monitor type. */ - extractAdress(monitorJSON) { + extractAddress(monitorJSON) { if (!monitorJSON) { return ""; } diff --git a/server/notification-providers/sevenio.js b/server/notification-providers/sevenio.js index 9d805d7e6..eac38a26e 100644 --- a/server/notification-providers/sevenio.js +++ b/server/notification-providers/sevenio.js @@ -32,7 +32,7 @@ class SevenIO extends NotificationProvider { return okMsg; } - let address = this.extractAdress(monitorJSON); + let address = this.extractAddress(monitorJSON); if (address !== "") { address = `(${address}) `; } diff --git a/server/notification-providers/signl4.js b/server/notification-providers/signl4.js index e48983f59..8261a73f3 100644 --- a/server/notification-providers/signl4.js +++ b/server/notification-providers/signl4.js @@ -18,7 +18,7 @@ class SIGNL4 extends NotificationProvider { msg, // Source system "X-S4-SourceSystem": "UptimeKuma", - monitorUrl: this.extractAdress(monitorJSON), + monitorUrl: this.extractAddress(monitorJSON), }; const config = { diff --git a/server/notification-providers/slack.js b/server/notification-providers/slack.js index 3676d6df3..f28a643e0 100644 --- a/server/notification-providers/slack.js +++ b/server/notification-providers/slack.js @@ -48,7 +48,7 @@ class Slack extends NotificationProvider { } - const address = this.extractAdress(monitorJSON); + const address = this.extractAddress(monitorJSON); if (address) { actions.push({ "type": "button", diff --git a/server/notification-providers/smtp.js b/server/notification-providers/smtp.js index 801e0e69d..9f3defa5e 100644 --- a/server/notification-providers/smtp.js +++ b/server/notification-providers/smtp.js @@ -93,7 +93,7 @@ class SMTP extends NotificationProvider { if (monitorJSON !== null) { monitorName = monitorJSON["name"]; - monitorHostnameOrURL = this.extractAdress(monitorJSON); + monitorHostnameOrURL = this.extractAddress(monitorJSON); } let serviceStatus = "⚠️ Test"; diff --git a/server/notification-providers/squadcast.js b/server/notification-providers/squadcast.js index 9074e9b76..5713783c0 100644 --- a/server/notification-providers/squadcast.js +++ b/server/notification-providers/squadcast.js @@ -34,7 +34,7 @@ class Squadcast extends NotificationProvider { data.status = "resolve"; } - data.tags["AlertAddress"] = this.extractAdress(monitorJSON); + data.tags["AlertAddress"] = this.extractAddress(monitorJSON); monitorJSON["tags"].forEach(tag => { data.tags[tag["name"]] = { diff --git a/server/notification-providers/teams.js b/server/notification-providers/teams.js index 2fcea7077..2793604cc 100644 --- a/server/notification-providers/teams.js +++ b/server/notification-providers/teams.js @@ -225,7 +225,7 @@ class Teams extends NotificationProvider { const payload = this._notificationPayloadFactory({ heartbeatJSON: heartbeatJSON, monitorName: monitorJSON.name, - monitorUrl: this.extractAdress(monitorJSON), + monitorUrl: this.extractAddress(monitorJSON), dashboardUrl: dashboardUrl, }); diff --git a/server/notification-providers/techulus-push.js b/server/notification-providers/techulus-push.js index 230897f3c..bf688b194 100644 --- a/server/notification-providers/techulus-push.js +++ b/server/notification-providers/techulus-push.js @@ -10,11 +10,22 @@ class TechulusPush extends NotificationProvider { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { const okMsg = "Sent Successfully."; + let data = { + "title": notification?.pushTitle?.length ? notification.pushTitle : "Uptime-Kuma", + "body": msg, + "timeSensitive": notification.pushTimeSensitive ?? true, + }; + + if (notification.pushChannel) { + data.channel = notification.pushChannel; + } + + if (notification.pushSound) { + data.sound = notification.pushSound; + } + try { - await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, { - "title": "Uptime-Kuma", - "body": msg, - }); + await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, data); return okMsg; } catch (error) { this.throwGeneralAxiosError(error); diff --git a/server/notification-providers/zoho-cliq.js b/server/notification-providers/zoho-cliq.js index 44681b7df..3a504de8c 100644 --- a/server/notification-providers/zoho-cliq.js +++ b/server/notification-providers/zoho-cliq.js @@ -85,7 +85,7 @@ class ZohoCliq extends NotificationProvider { const payload = this._notificationPayloadFactory({ monitorMessage: heartbeatJSON.msg, monitorName: monitorJSON.name, - monitorUrl: this.extractAdress(monitorJSON), + monitorUrl: this.extractAddress(monitorJSON), status: heartbeatJSON.status }); diff --git a/src/components/notifications/TechulusPush.vue b/src/components/notifications/TechulusPush.vue index bece17e27..bb2c27ad8 100644 --- a/src/components/notifications/TechulusPush.vue +++ b/src/components/notifications/TechulusPush.vue @@ -4,6 +4,53 @@ +
+ + +
+ +
+ + +
+ {{ $t("Alphanumerical string and hyphens only") }} +
+
+ +
+ + +
+ {{ $t("Custom sound to override default notification sound") }} +
+
+ +
+
+ + +
+
+ {{ $t("Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.") }} +
+
+ https://docs.push.techulus.com @@ -16,5 +63,19 @@ export default { components: { HiddenInput, }, + mounted() { + if (typeof this.$parent.notification.pushTitle === "undefined") { + this.$parent.notification.pushTitle = "Uptime-Kuma"; + } + if (typeof this.$parent.notification.pushChannel === "undefined") { + this.$parent.notification.pushChannel = "uptime-kuma"; + } + if (typeof this.$parent.notification.pushSound === "undefined") { + this.$parent.notification.pushSound = "default"; + } + if (typeof this.$parent.notification.pushTimeSensitive === "undefined") { + this.$parent.notification.pushTimeSensitive = true; + } + }, }; diff --git a/src/lang/en.json b/src/lang/en.json index 968a3d9f8..cf0836d98 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1027,5 +1027,25 @@ "greater than": "greater than", "less than or equal to": "less than or equal to", "greater than or equal to": "greater than or equal to", - "record": "record" + "record": "record", + "Notification Channel": "Notification Channel", + "Sound": "Sound", + "Alphanumerical string and hyphens only": "Alphanumerical string and hyphens only", + "Arcade": "Arcade", + "Correct": "Correct", + "Fail":"Fail", + "Harp":"Harp", + "Reveal":"Reveal", + "Bubble":"Bubble", + "Doorbell":"Doorbell", + "Flute":"Flute", + "Money":"Money", + "Scifi":"Scifi", + "Clear":"Clear", + "Elevator":"Elevator", + "Guitar":"Guitar", + "Pop":"Pop", + "Custom sound to override default notification sound": "Custom sound to override default notification sound", + "Time Sensitive (iOS Only)": "Time Sensitive (iOS Only)", + "Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode.": "Time sensitive notifications will be delivered immediately, even if the device is in do not disturb mode." } diff --git a/src/util.js b/src/util.js index b1da34922..df89cf92b 100644 --- a/src/util.js +++ b/src/util.js @@ -458,4 +458,4 @@ async function evaluateJsonQuery(data, jsonPath, jsonPathOperator, expectedValue throw new Error(`Error evaluating JSON query: ${err.message}. Response from server was: ${response}`); } } -exports.evaluateJsonQuery = evaluateJsonQuery; +exports.evaluateJsonQuery = evaluateJsonQuery; \ No newline at end of file diff --git a/src/util.ts b/src/util.ts index efc8f3a89..b3bab4fff 100644 --- a/src/util.ts +++ b/src/util.ts @@ -120,7 +120,11 @@ export const badgeConstants = { defaultCertExpireDownDays: "7" }; -/** Flip the status of s */ +/** + * Flip the status of s between UP and DOWN if this is possible + * @param s {number} status + * @returns {number} flipped status + */ export function flipStatus(s: number) { if (s === UP) { return DOWN;