mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-08-07 09:04:59 +00:00
feat: Add Pinglet notification provider (#7632)
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
|
||||
class Pinglet extends NotificationProvider {
|
||||
name = "pinglet";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
let publishUrl = notification.pingletPublishUrl;
|
||||
if (publishUrl.endsWith("/")) {
|
||||
publishUrl = publishUrl.slice(0, -1);
|
||||
}
|
||||
|
||||
const config = this.getAxiosConfigWithProxy({
|
||||
headers: {
|
||||
Authorization: "Bearer " + notification.pingletApiKey,
|
||||
},
|
||||
params: {
|
||||
rewrite: "uptimekuma",
|
||||
},
|
||||
});
|
||||
|
||||
// Pinglet's uptimekuma rewriter accepts Uptime Kuma's webhook payload
|
||||
// as-is and maps it to a titled message with level and priority
|
||||
// server-side, so this provider just forwards the raw shape.
|
||||
await axios.post(
|
||||
publishUrl,
|
||||
{
|
||||
heartbeat: heartbeatJSON,
|
||||
monitor: monitorJSON,
|
||||
msg,
|
||||
},
|
||||
config
|
||||
);
|
||||
|
||||
return okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Pinglet;
|
||||
@@ -45,6 +45,7 @@ const Pumble = require("./notification-providers/pumble");
|
||||
const FlashDuty = require("./notification-providers/flashduty");
|
||||
const Flowtriq = require("./notification-providers/flowtriq");
|
||||
const PagerTree = require("./notification-providers/pagertree");
|
||||
const Pinglet = require("./notification-providers/pinglet");
|
||||
const Plivo = require("./notification-providers/plivo");
|
||||
const PromoSMS = require("./notification-providers/promosms");
|
||||
const Pushbullet = require("./notification-providers/pushbullet");
|
||||
@@ -159,6 +160,7 @@ class Notification {
|
||||
new FlashDuty(),
|
||||
new Flowtriq(),
|
||||
new PagerTree(),
|
||||
new Pinglet(),
|
||||
new Plivo(),
|
||||
new PromoSMS(),
|
||||
new Pumble(),
|
||||
|
||||
@@ -257,6 +257,7 @@ export default {
|
||||
lunasea: "LunaSea",
|
||||
notifery: "Notifery",
|
||||
ntfy: "Ntfy",
|
||||
pinglet: "Pinglet",
|
||||
pushbullet: "Pushbullet",
|
||||
PushByTechulus: "Push by Techulus",
|
||||
pushover: "Pushover",
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="pinglet-publish-url" class="form-label">
|
||||
{{ $t("Pinglet Topic URL") }}
|
||||
<span style="color: red"><sup>*</sup></span>
|
||||
</label>
|
||||
<input
|
||||
id="pinglet-publish-url"
|
||||
v-model="$parent.notification.pingletPublishUrl"
|
||||
type="url"
|
||||
class="form-control"
|
||||
required
|
||||
autocomplete="false"
|
||||
placeholder="https://app.pinglet.co.uk/your-namespace/alerts"
|
||||
/>
|
||||
<div class="form-text">
|
||||
{{ $t("pingletTopicUrlDescription") }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pinglet-api-key" class="form-label">
|
||||
{{ $t("API Key") }}
|
||||
<span style="color: red"><sup>*</sup></span>
|
||||
</label>
|
||||
<HiddenInput
|
||||
id="pinglet-api-key"
|
||||
v-model="$parent.notification.pingletApiKey"
|
||||
:required="true"
|
||||
autocomplete="new-password"
|
||||
></HiddenInput>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -44,6 +44,7 @@ import PagerDuty from "./PagerDuty.vue";
|
||||
import FlashDuty from "./FlashDuty.vue";
|
||||
import Flowtriq from "./Flowtriq.vue";
|
||||
import PagerTree from "./PagerTree.vue";
|
||||
import Pinglet from "./Pinglet.vue";
|
||||
import Plivo from "./Plivo.vue";
|
||||
import PromoSMS from "./PromoSMS.vue";
|
||||
import Pumble from "./Pumble.vue";
|
||||
@@ -147,6 +148,7 @@ const NotificationFormList = {
|
||||
FlashDuty: FlashDuty,
|
||||
Flowtriq: Flowtriq,
|
||||
PagerTree: PagerTree,
|
||||
pinglet: Pinglet,
|
||||
plivo: Plivo,
|
||||
promosms: PromoSMS,
|
||||
pumble: Pumble,
|
||||
|
||||
@@ -1127,6 +1127,8 @@
|
||||
"Flowtriq Webhook URL": "Webhook URL",
|
||||
"Flowtriq API Key": "API Key",
|
||||
"flowtriqApiKeyDescription": "Optional API key for authenticating webhook requests to your Flowtriq instance.",
|
||||
"Pinglet Topic URL": "Topic URL",
|
||||
"pingletTopicUrlDescription": "The publish URL of the Pinglet topic to send alerts to, e.g. https://app.pinglet.co.uk/your-namespace/alerts. The topic is created on first publish if it doesn't exist yet.",
|
||||
"nostrRelays": "Nostr relays",
|
||||
"nostrRelaysHelp": "One relay URL per line",
|
||||
"nostrSender": "Sender Private Key (nsec)",
|
||||
|
||||
Reference in New Issue
Block a user