mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 12:22:22 +08:00
Merge branch 'master' into something
This commit is contained in:
@@ -15,7 +15,7 @@ class Notification {
|
||||
})
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class Notification {
|
||||
})
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class Notification {
|
||||
await axios.post(notification.webhookURL, finalData, config)
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class Notification {
|
||||
await axios.post(notification.discordWebhookUrl, data)
|
||||
return true;
|
||||
} catch(error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -122,20 +122,25 @@ class Notification {
|
||||
await axios.post(notification.signalURL, data, config)
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (notification.type === "slack") {
|
||||
try {
|
||||
if (heartbeatJSON == null) {
|
||||
let data = {'text': "Uptime Kuma Slack testing successful."}
|
||||
let data = {'text': "Uptime Kuma Slack testing successful.", 'channel': notification.slackchannel, 'username': notification.slackusername, 'icon_emoji': notification.slackiconemo}
|
||||
await axios.post(notification.slackwebhookURL, data)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const time = heartbeatJSON["time"];
|
||||
let data = {
|
||||
"text": "Uptime Kuma Alert",
|
||||
"channel":notification.slackchannel,
|
||||
"username": notification.slackusername,
|
||||
"icon_emoji": notification.slackiconemo,
|
||||
"blocks": [{
|
||||
"type": "header",
|
||||
"text": {
|
||||
@@ -156,23 +161,52 @@ class Notification {
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "actions",
|
||||
"elements": [
|
||||
{
|
||||
"type": "button",
|
||||
"text": {
|
||||
"type": "actions",
|
||||
"elements": [
|
||||
{
|
||||
"type": "button",
|
||||
"text": {
|
||||
"type": "plain_text",
|
||||
"text": "Visit Uptime Kuma",
|
||||
},
|
||||
"value": "Uptime-Kuma",
|
||||
"url": notification.slackbutton
|
||||
}
|
||||
"value": "Uptime-Kuma",
|
||||
"url": notification.slackbutton || "https://github.com/louislam/uptime-kuma"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
await axios.post(notification.slackwebhookURL, data)
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (notification.type === "pushover") {
|
||||
var pushoverlink = 'https://api.pushover.net/1/messages.json'
|
||||
try {
|
||||
if (heartbeatJSON == null) {
|
||||
let data = {'message': "<b>Uptime Kuma Pushover testing successful.</b>",
|
||||
'user': notification.pushoveruserkey, 'token': notification.pushoverapptoken, 'sound':notification.pushoversounds,
|
||||
'priority': notification.pushoverpriority, 'title':notification.pushovertitle, 'retry': "30", 'expire':"3600", 'html': 1}
|
||||
let res = await axios.post(pushoverlink, data)
|
||||
return true;
|
||||
}
|
||||
|
||||
let data = {
|
||||
"message": "<b>Uptime Kuma Alert</b>\n\n<b>Message</b>:" +msg + '\n<b>Time (UTC)</b>:' +time,
|
||||
"user":notification.pushoveruserkey,
|
||||
"token": notification.pushoverapptoken,
|
||||
"sound": notification.pushoversounds,
|
||||
"priority": notification.pushoverpriority,
|
||||
"title": notification.pushovertitle,
|
||||
"retry": "30",
|
||||
"expire": "3600",
|
||||
"html": 1
|
||||
}
|
||||
let res = await axios.post(pushoverlink, data)
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user