Merge remote-tracking branch 'origin/master' into ntfy-icon

# Conflicts:
#	server/notification-providers/ntfy.js
#	src/components/notifications/Ntfy.vue
#	src/languages/en.js
This commit is contained in:
Louis Lam
2022-10-31 17:10:20 +08:00
121 changed files with 4931 additions and 2523 deletions

View File

@@ -7,18 +7,26 @@ class Ntfy extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully.";
var ntfyparams = {
try {
let headers = {};
if (notification.ntfyusername) {
headers = {
"Authorization": "Basic " + Buffer.from(notification.ntfyusername + ":" + notification.ntfypassword).toString("base64"),
};
}
let data = {
"topic": notification.ntfytopic,
"message": msg,
"priority": notification.ntfyPriority || 4,
"title": "Uptime-Kuma",
};
if (notification.ntfyIcon) {
ntfyparams.icon = notification.ntfyIcon;
}
};
if (notification.ntfyIcon) {
data.icon = notification.ntfyIcon;
}
await axios.post(`${notification.ntfyserverurl}`, data, { headers: headers });
try {
await axios.post(`${notification.ntfyserverurl}`, ntfyparams);
return okMsg;
} catch (error) {