mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-11-10 21:21:19 +08:00
feat: add Notify! notification provider (#7740)
This commit is contained in:
1 parent
1480c8d512
commit
437fcd20ab
6 files changed
+106
No files matched your search
@@ -0,0 +1,49 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const { DOWN, UP } = require("../../src/util");
|
||||
const axios = require("axios");
|
||||
|
||||
const NOTIFY_API_BASE = "https://push.getnotifyapp.com";
|
||||
|
||||
class NotifyApp extends NotificationProvider {
|
||||
name = "notifyapp";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
let title = monitorJSON?.name || "Uptime Kuma";
|
||||
if (heartbeatJSON != null) {
|
||||
title += ` is ${heartbeatJSON["status"] === UP ? "UP" : "DOWN"}`;
|
||||
}
|
||||
|
||||
const body = {
|
||||
text: msg,
|
||||
title: title,
|
||||
};
|
||||
|
||||
if (notification.notifyAppIconUrl) {
|
||||
body.iconUrl = notification.notifyAppIconUrl;
|
||||
}
|
||||
|
||||
// Notify! uses this to break through Focus and quiet hours.
|
||||
if (heartbeatJSON != null && heartbeatJSON["status"] === DOWN) {
|
||||
body.timeSensitive = true;
|
||||
}
|
||||
|
||||
await axios.post(
|
||||
`${NOTIFY_API_BASE}/notify-json/${encodeURIComponent(notification.notifyAppDeviceId)}?token=${encodeURIComponent(notification.notifyAppToken)}`,
|
||||
body,
|
||||
this.getAxiosConfigWithProxy({})
|
||||
);
|
||||
|
||||
return okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = NotifyApp;
|
||||
@@ -35,6 +35,7 @@ const Matrix = require("./notification-providers/matrix");
|
||||
const Mattermost = require("./notification-providers/mattermost");
|
||||
const NextcloudTalk = require("./notification-providers/nextcloudtalk");
|
||||
const Nostr = require("./notification-providers/nostr");
|
||||
const NotifyApp = require("./notification-providers/notifyapp");
|
||||
const Ntfy = require("./notification-providers/ntfy");
|
||||
const Octopush = require("./notification-providers/octopush");
|
||||
const OneChat = require("./notification-providers/onechat");
|
||||
@@ -156,6 +157,7 @@ class Notification {
|
||||
new Mattermost(),
|
||||
new NextcloudTalk(),
|
||||
new Nostr(),
|
||||
new NotifyApp(),
|
||||
new Ntfy(),
|
||||
new Octopush(),
|
||||
new OneChat(),
|
||||
|
||||
@@ -259,6 +259,7 @@ export default {
|
||||
gotify: "Gotify",
|
||||
lunasea: "LunaSea",
|
||||
notifery: "Notifery",
|
||||
notifyapp: "Notify!",
|
||||
ntfy: "Ntfy",
|
||||
pinglet: "Pinglet",
|
||||
pushbullet: "Pushbullet",
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="notifyapp-device-id" class="form-label">{{ $t("Device ID or Group ID") }}</label>
|
||||
<input
|
||||
id="notifyapp-device-id"
|
||||
v-model="$parent.notification.notifyAppDeviceId"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required
|
||||
placeholder="ABC12345"
|
||||
/>
|
||||
<div class="form-text">
|
||||
{{ $t("notifyAppDeviceIdDescription") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="notifyapp-token" class="form-label">{{ $t("Token") }}</label>
|
||||
<HiddenInput
|
||||
id="notifyapp-token"
|
||||
v-model="$parent.notification.notifyAppToken"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="notifyapp-icon-url" class="form-label">{{ $t("Icon URL") }}</label>
|
||||
<input
|
||||
id="notifyapp-icon-url"
|
||||
v-model="$parent.notification.notifyAppIconUrl"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<i18n-t tag="p" keypath="notifyAppSetup" class="form-text">
|
||||
<a href="https://getnotifyapp.com" target="_blank" rel="noopener">getnotifyapp.com</a>
|
||||
</i18n-t>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -34,6 +34,7 @@ import Matrix from "./Matrix.vue";
|
||||
import Mattermost from "./Mattermost.vue";
|
||||
import NextcloudTalk from "./NextcloudTalk.vue";
|
||||
import Nostr from "./Nostr.vue";
|
||||
import NotifyApp from "./NotifyApp.vue";
|
||||
import Ntfy from "./Ntfy.vue";
|
||||
import Octopush from "./Octopush.vue";
|
||||
import OneChat from "./OneChat.vue";
|
||||
@@ -144,6 +145,7 @@ const NotificationFormList = {
|
||||
mattermost: Mattermost,
|
||||
nextcloudtalk: NextcloudTalk,
|
||||
nostr: Nostr,
|
||||
notifyapp: NotifyApp,
|
||||
ntfy: Ntfy,
|
||||
octopush: Octopush,
|
||||
OneChat: OneChat,
|
||||
|
||||
@@ -1044,6 +1044,9 @@
|
||||
"ntfyCustomTitle": "Custom Title Template",
|
||||
"ntfyCustomMessage": "Custom Message Template",
|
||||
"ntfyNotificationTemplateFallback": "Leave blank to use the default Uptime Kuma format",
|
||||
"Device ID or Group ID": "Device ID or Group ID",
|
||||
"notifyAppDeviceIdDescription": "The Device ID from the Notify! app, or a Group ID to alert every device in a group at once.",
|
||||
"notifyAppSetup": "Open Notify! and find your Device ID and token under Settings. No account is required. Learn more at {0}.",
|
||||
"telnyxApiKey": "API Key (V2)",
|
||||
"telnyxApiKeyHelptext": "Your Telnyx V2 API key from the Telnyx Portal under API Keys",
|
||||
"telnyxPhoneNumber": "From Number",
|
||||
|
||||
Reference in new issue
Block a user