diff --git a/server/notification.js b/server/notification.js
index 59fb355..b6b7b7a 100644
--- a/server/notification.js
+++ b/server/notification.js
@@ -1,5 +1,5 @@
const axios = require("axios");
-const {R} = require("redbean-node");
+const { R } = require("redbean-node");
const FormData = require('form-data');
const nodemailer = require("nodemailer");
@@ -52,45 +52,61 @@ class Notification {
} else if (notification.type === "smtp") {
return await Notification.smtp(notification, msg)
+ } else if (notification.type === "signal") {
+ try {
+ let data = {
+ "message": msg,
+ "number": notification.signalNumber,
+ "recipients": notification.signalRecipients.replace(/\s/g, '').split(",")
+ };
+ let config = {};
+
+ let res = await axios.post(notification.signalURL, data, config)
+ return true;
+ } catch (error) {
+ console.log(error)
+ return false;
+ }
+
} else if (notification.type === "discord") {
try {
- // If heartbeatJSON is null, assume we're testing.
- if(heartbeatJSON == null) {
+ // If heartbeatJSON is null, assume we're testing.
+ if (heartbeatJSON == null) {
+ let data = {
+ username: 'Uptime-Kuma',
+ content: msg
+ }
+ let res = await axios.post(notification.discordWebhookUrl, data)
+ return true;
+ }
+ // If heartbeatJSON is not null, we go into the normal alerting loop.
+ if (heartbeatJSON['status'] == 0) {
+ var alertColor = "16711680";
+ } else if (heartbeatJSON['status'] == 1) {
+ var alertColor = "65280";
+ }
let data = {
- username: 'Uptime-Kuma',
- content: msg
+ username: 'Uptime-Kuma',
+ embeds: [{
+ title: "Uptime-Kuma Alert",
+ color: alertColor,
+ fields: [
+ {
+ name: "Time (UTC)",
+ value: heartbeatJSON["time"]
+ },
+ {
+ name: "Message",
+ value: msg
+ }
+ ]
+ }]
}
let res = await axios.post(notification.discordWebhookUrl, data)
return true;
- }
- // If heartbeatJSON is not null, we go into the normal alerting loop.
- if(heartbeatJSON['status'] == 0) {
- var alertColor = "16711680";
- } else if(heartbeatJSON['status'] == 1) {
- var alertColor = "65280";
- }
- let data = {
- username: 'Uptime-Kuma',
- embeds: [{
- title: "Uptime-Kuma Alert",
- color: alertColor,
- fields: [
- {
- name: "Time (UTC)",
- value: heartbeatJSON["time"]
- },
- {
- name: "Message",
- value: msg
- }
- ]
- }]
- }
- let res = await axios.post(notification.discordWebhookUrl, data)
- return true;
- } catch(error) {
- console.log(error)
- return false;
+ } catch (error) {
+ console.log(error)
+ return false;
}
} else {
throw new Error("Notification type is not supported")
@@ -106,7 +122,7 @@ class Notification {
userID,
])
- if (! bean) {
+ if (!bean) {
throw new Error("notification not found")
}
@@ -126,7 +142,7 @@ class Notification {
userID,
])
- if (! bean) {
+ if (!bean) {
throw new Error("notification not found")
}
diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue
index 316bd58..44454d6 100644
--- a/src/components/NotificationDialog.vue
+++ b/src/components/NotificationDialog.vue
@@ -17,6 +17,7 @@
+
@@ -133,6 +134,41 @@
+
+
+ You can check this url to view how to setup one:
+
+ https://github.com/bbernhard/signal-cli-rest-api
+
+ IMPORTANT: You cannot mix groups and numbers in recipients!
+