mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 09:55:47 +08:00
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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user