feat: add discord and pushover as notification agents (#300)

fix: most error messages of the notifications endpoints would not reach the frontend
This commit is contained in:
Miguel Ribeiro
2024-05-06 18:55:10 +02:00
committed by GitHub
parent 4199d4c3e7
commit 899482982e
40 changed files with 2317 additions and 23 deletions
+71
View File
@@ -210,3 +210,74 @@ function testNotificationsGotifyButton() {
makeFetchCall('endpoints/notifications/testgotifynotifications.php', data, button);
}
function saveNotificationsPushoverButton() {
const button = document.getElementById("saveNotificationsPushover");
button.disabled = true;
const enabled = document.getElementById("pushoverenabled").checked ? 1 : 0;
const user_key = document.getElementById("pushoveruserkey").value;
const token = document.getElementById("pushovertoken").value;
const data = {
enabled: enabled,
user_key: user_key,
token: token
};
makeFetchCall('endpoints/notifications/savepushovernotifications.php', data, button);
}
function testNotificationsPushoverButton() {
const button = document.getElementById("testNotificationsPushover");
button.disabled = true;
const enabled = document.getElementById("pushoverenabled").checked ? 1 : 0;
const user_key = document.getElementById("pushoveruserkey").value;
const token = document.getElementById("pushovertoken").value;
const data = {
enabled: enabled,
user_key: user_key,
token: token
};
makeFetchCall('endpoints/notifications/testpushovernotifications.php', data, button);
}
function saveNotificationsDiscordButton() {
const button = document.getElementById("saveNotificationsDiscord");
button.disabled = true;
const enabled = document.getElementById("discordenabled").checked ? 1 : 0;
const url = document.getElementById("discordurl").value;
const bot_username = document.getElementById("discordbotusername").value;
const bot_avatar = document.getElementById("discordbotavatar").value;
const data = {
enabled: enabled,
url: url,
bot_username: bot_username,
bot_avatar: bot_avatar
};
makeFetchCall('endpoints/notifications/savediscordnotifications.php', data, button);
}
function testNotificationsDiscordButton() {
const button = document.getElementById("testNotificationsDiscord");
button.disabled = true;
const enabled = document.getElementById("discordenabled").checked ? 1 : 0;
const url = document.getElementById("discordurl").value;
const bot_username = document.getElementById("discordbotusername").value;
const bot_avatar = document.getElementById("discordbotavatar").value;
const data = {
enabled: enabled,
url: url,
bot_username: bot_username,
bot_avatar: bot_avatar
};
makeFetchCall('endpoints/notifications/testdiscordnotifications.php', data, button);
}