mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Undo parm changes
This commit is contained in:
parent
b0acda52f9
commit
41d32bb9dd
3 changed files with 12 additions and 15 deletions
|
@ -270,9 +270,18 @@ class Monitor extends BeanModel {
|
|||
this.id,
|
||||
])
|
||||
|
||||
let text;
|
||||
if (bean.status === UP) {
|
||||
text = "✅ Up"
|
||||
} else {
|
||||
text = "🔴 Down"
|
||||
}
|
||||
|
||||
let msg = `[${this.name}] [${text}] ${bean.msg}`;
|
||||
|
||||
for (let notification of notificationList) {
|
||||
try {
|
||||
await Notification.send(JSON.parse(notification.config), this.name, await this.toJSON(), bean.toJSON())
|
||||
await Notification.send(JSON.parse(notification.config), msg, await this.toJSON(), bean.toJSON())
|
||||
} catch (e) {
|
||||
console.error("Cannot send notification to " + notification.name);
|
||||
console.log(e);
|
||||
|
|
|
@ -17,21 +17,9 @@ class Notification {
|
|||
* @returns {Promise<string>} Successful msg
|
||||
* Throw Error with fail msg
|
||||
*/
|
||||
static async send(notification, monitorName = null, monitorJSON = null, heartbeatJSON = null) {
|
||||
static async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
let okMsg = "Sent Successfully. ";
|
||||
|
||||
let msg = `[${notification.name}] Testing`;
|
||||
// heartbeatJSON is only defined if we're not testing
|
||||
if(heartbeatJSON) {
|
||||
let text;
|
||||
if (heartbeatJSON["status"] === UP) {
|
||||
text = "✅ Up"
|
||||
} else {
|
||||
text = "🔴 Down"
|
||||
}
|
||||
msg = `[${monitorName}] [${text}] ${heartbeatJSON["msg"]}`;
|
||||
}
|
||||
|
||||
if (notification.type === "telegram") {
|
||||
try {
|
||||
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, {
|
||||
|
|
|
@ -552,7 +552,7 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
|
|||
try {
|
||||
checkLogin(socket)
|
||||
|
||||
let msg = await Notification.send(notification)
|
||||
let msg = await Notification.send(notification, notification.name + " Testing")
|
||||
|
||||
callback({
|
||||
ok: true,
|
||||
|
|
Loading…
Reference in a new issue