Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new notification provider 46elks #5184

Merged
merged 31 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c560314
fixing 46elks sms api
erlaan Oct 9, 2024
1a5fbc1
I am stupied
erlaan Oct 9, 2024
3e8109d
something is wrong
erlaan Oct 9, 2024
af093fa
maybe it working now.
erlaan Oct 9, 2024
e4fd418
Maybe it will work now. I have no clue what i am doing
erlaan Oct 9, 2024
38c56ee
Now I think i am on right track to solv this :). I have no clue what …
erlaan Oct 9, 2024
47d18f7
Somting is wong :). I have no clue what i am doing
erlaan Oct 9, 2024
f9e2982
This time it may work.... I have no clue what i am doing
erlaan Oct 9, 2024
ae5f9e3
I am stupied turnd the list wrong direction... I have no clue what i …
erlaan Oct 9, 2024
e113ba1
I hope this solvs it. I referesn wrong variable. Still have no clue w…
erlaan Oct 9, 2024
de3cb26
Merge branch 'louislam:master' into master
erlaan Oct 10, 2024
f9033fd
Fixing the translating part and some tweeking
erlaan Oct 10, 2024
9dd25c2
Merge branch 'master' of github.com:erlaan/uptime-kuma
erlaan Oct 10, 2024
9494a6e
Merge branch 'louislam:master' into master
erlaan Oct 10, 2024
23192e8
Fix the indentationen to 4 spaces
erlaan Oct 10, 2024
5eb5fed
Merge branch 'master' of github.com:erlaan/uptime-kuma
erlaan Oct 10, 2024
47161a9
removed some code that was used for debugging
erlaan Oct 10, 2024
f40b14e
Hade some error in my code with missing semicolons and a few miss ind…
erlaan Oct 10, 2024
40ab5c5
This is hard to find all errors i made but maybe i fixed everything t…
erlaan Oct 10, 2024
3e37a1c
Now I think i have manage to have the right indentation and no traili…
erlaan Oct 10, 2024
d17d4df
I think it is a ghost adding spaces and doing indentation wrong on sa…
erlaan Oct 10, 2024
7bc1810
I need to learn how to read the errors.. this time it will work.
erlaan Oct 10, 2024
1b00238
Made some changes based on CommanderStorm suggestions in the PR
erlaan Oct 11, 2024
02ce1b6
Merge branch 'master' into master
erlaan Oct 11, 2024
2a19c4a
I missed a , in the json file.
erlaan Oct 11, 2024
f2f25dc
Ofcourse i can not keep my finger in check.
erlaan Oct 11, 2024
d72fee3
Eslint did i do this time?
erlaan Oct 11, 2024
20e4fd1
I notice i missed a translatekey in en.json so i added it
erlaan Oct 11, 2024
0624458
Applied formatting change
CommanderStorm Oct 11, 2024
71f3aa3
Applied formatting change
CommanderStorm Oct 11, 2024
5e497db
Applied formatting change
CommanderStorm Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions server/notification-providers/46elks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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.";

try {

const url = "https://api.46elks.com/a1/sms";

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);
}

}

CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
}

module.exports = Elks;
2 changes: 2 additions & 0 deletions server/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const CallMeBot = require("./notification-providers/call-me-bot");
const SMSC = require("./notification-providers/smsc");
const DingDing = require("./notification-providers/dingding");
const Discord = require("./notification-providers/discord");
const Elks = require("./notification-providers/46elks");
const Feishu = require("./notification-providers/feishu");
const FreeMobile = require("./notification-providers/freemobile");
const GoogleChat = require("./notification-providers/google-chat");
Expand Down Expand Up @@ -95,6 +96,7 @@ class Notification {
new SMSC(),
new DingDing(),
new Discord(),
new Elks(),
new Feishu(),
new FreeMobile(),
new GoogleChat(),
Expand Down
1 change: 1 addition & 0 deletions src/components/NotificationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export default {
"clicksendsms": "ClickSend SMS",
"CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)",
"discord": "Discord",
"Elks": "46elks",
"GoogleChat": "Google Chat (Google Workspace)",
"gorush": "Gorush",
"gotify": "Gotify",
Expand Down
48 changes: 48 additions & 0 deletions src/components/notifications/46elks.vue
Original file line number Diff line number Diff line change
@@ -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>
erlaan marked this conversation as resolved.
Show resolved Hide resolved
<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.") }}
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
<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>
2 changes: 2 additions & 0 deletions src/components/notifications/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import CallMeBot from "./CallMeBot.vue";
import SMSC from "./SMSC.vue";
import DingDing from "./DingDing.vue";
import Discord from "./Discord.vue";
import Elks from "./46elks.vue";
import Feishu from "./Feishu.vue";
import FreeMobile from "./FreeMobile.vue";
import GoogleChat from "./GoogleChat.vue";
Expand Down Expand Up @@ -82,6 +83,7 @@ const NotificationFormList = {
"smsc": SMSC,
"DingDing": DingDing,
"discord": Discord,
"Elks": Elks,
"Feishu": Feishu,
"FreeMobile": FreeMobile,
"GoogleChat": GoogleChat,
Expand Down
6 changes: 5 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,5 +1047,9 @@
"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."
"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."
CommanderStorm marked this conversation as resolved.
Show resolved Hide resolved
}
Loading