1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-12-22 22:13:20 +02:00

feat: new notification provider 46elks (#5184)
Some checks failed
Auto Test / check-linters (push) Successful in 2m8s
Merge Conflict Labeler / Labeling (push) Has been skipped
json-yaml-validate / json-yaml-validate (push) Successful in 8s
Auto Test / auto-test (18, ubuntu-latest) (push) Successful in 2m26s
Auto Test / auto-test (20, ubuntu-latest) (push) Successful in 2m18s
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
CodeQL / Analyze (go) (push) Failing after 35s
CodeQL / Analyze (javascript-typescript) (push) Failing after 24s
Automatically close stale issues / stale (push) Successful in 8s

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Erlaan 2024-10-11 11:07:34 +02:00 committed by GitHub
parent bafca6bd37
commit dda40610c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 93 additions and 1 deletions

View File

@ -0,0 +1,35 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class Elks extends NotificationProvider {
name = "Elks";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = "https://api.46elks.com/a1/sms";
try {
let data = new URLSearchParams();
data.append("from", notification.elksFromNumber);
data.append("to", notification.elksToNumber );
data.append("message", msg);
const config = {
headers: {
"Authorization": "Basic " + Buffer.from(`${notification.elksUsername}:${notification.elksAuthToken}`).toString("base64")
}
};
await axios.post(url, data, config);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = Elks;

View File

@ -11,6 +11,7 @@ const CallMeBot = require("./notification-providers/call-me-bot");
const SMSC = require("./notification-providers/smsc"); const SMSC = require("./notification-providers/smsc");
const DingDing = require("./notification-providers/dingding"); const DingDing = require("./notification-providers/dingding");
const Discord = require("./notification-providers/discord"); const Discord = require("./notification-providers/discord");
const Elks = require("./notification-providers/46elks");
const Feishu = require("./notification-providers/feishu"); const Feishu = require("./notification-providers/feishu");
const FreeMobile = require("./notification-providers/freemobile"); const FreeMobile = require("./notification-providers/freemobile");
const GoogleChat = require("./notification-providers/google-chat"); const GoogleChat = require("./notification-providers/google-chat");
@ -95,6 +96,7 @@ class Notification {
new SMSC(), new SMSC(),
new DingDing(), new DingDing(),
new Discord(), new Discord(),
new Elks(),
new Feishu(), new Feishu(),
new FreeMobile(), new FreeMobile(),
new GoogleChat(), new GoogleChat(),

View File

@ -118,6 +118,7 @@ export default {
"clicksendsms": "ClickSend SMS", "clicksendsms": "ClickSend SMS",
"CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)", "CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)",
"discord": "Discord", "discord": "Discord",
"Elks": "46elks",
"GoogleChat": "Google Chat (Google Workspace)", "GoogleChat": "Google Chat (Google Workspace)",
"gorush": "Gorush", "gorush": "Gorush",
"gotify": "Gotify", "gotify": "Gotify",

View File

@ -0,0 +1,48 @@
<template>
<div class="mb-3">
<label for="ElksUsername" class="form-label">{{ $t("Username") }}</label>
<input id="ElksUsername" v-model="$parent.notification.elksUsername" type="text" class="form-control" required>
<label for="ElksPassword" class="form-label">{{ $t("Password") }}</label>
</div>
<div class="form-text">
<HiddenInput id="ElksPassword" v-model="$parent.notification.elksAuthToken" :required="true" autocomplete="new-password"></HiddenInput>
<i18n-t tag="p" keypath="Can be found on:">
<a href="https://46elks.com/account" target="_blank">https://46elks.com/account</a>
</i18n-t>
</div>
<div class="mb-3">
<label for="Elks-from-number" class="form-label">{{ $t("From") }}</label>
<input id="Elks-from-number" v-model="$parent.notification.elksFromNumber" type="text" class="form-control" required>
<div class="form-text">
{{ $t("Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.") }}
<i18n-t tag="p" keypath="More info on:">
<a href="https://46elks.se/kb/text-sender-id" target="_blank">https://46elks.se/kb/text-sender-id</a>
</i18n-t>
</div>
</div>
<div class="mb-3">
<label for="Elks-to-number" class="form-label">{{ $t("To Number") }}</label>
<input id="Elks-to-number" v-model="$parent.notification.elksToNumber" type="text" class="form-control" required>
<div class="form-text">
{{ $t("The phone number of the recipient in E.164 format.") }}
<i18n-t tag="p" keypath="More info on:">
<a href="https://46elks.se/kb/e164" target="_blank">https://46elks.se/kb/e164</a>
</i18n-t>
</div>
</div>
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">
<a href="https://46elks.com/docs/send-sms" target="_blank">https://46elks.com/docs/send-sms</a>
</i18n-t>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

View File

@ -9,6 +9,7 @@ import CallMeBot from "./CallMeBot.vue";
import SMSC from "./SMSC.vue"; import SMSC from "./SMSC.vue";
import DingDing from "./DingDing.vue"; import DingDing from "./DingDing.vue";
import Discord from "./Discord.vue"; import Discord from "./Discord.vue";
import Elks from "./46elks.vue";
import Feishu from "./Feishu.vue"; import Feishu from "./Feishu.vue";
import FreeMobile from "./FreeMobile.vue"; import FreeMobile from "./FreeMobile.vue";
import GoogleChat from "./GoogleChat.vue"; import GoogleChat from "./GoogleChat.vue";
@ -82,6 +83,7 @@ const NotificationFormList = {
"smsc": SMSC, "smsc": SMSC,
"DingDing": DingDing, "DingDing": DingDing,
"discord": Discord, "discord": Discord,
"Elks": Elks,
"Feishu": Feishu, "Feishu": Feishu,
"FreeMobile": FreeMobile, "FreeMobile": FreeMobile,
"GoogleChat": GoogleChat, "GoogleChat": GoogleChat,

View File

@ -1047,5 +1047,9 @@
"Pop":"Pop", "Pop":"Pop",
"Custom sound to override default notification sound": "Custom sound to override default notification sound", "Custom sound to override default notification sound": "Custom sound to override default notification sound",
"Time Sensitive (iOS Only)": "Time Sensitive (iOS Only)", "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." "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.",
"From":"From",
"Can be found on:": "Can be found on: {0}",
"The phone number of the recipient in E.164 format.": "The phone number of the recipient in E.164 format.",
"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies.":"Either a text sender ID or a phone number in E.164 format if you want to be able to receive replies."
} }