Repository: louislam/uptime-kuma
File: server/notification.js (JavaScript)

Code before:
        } else if (notification.type === "lunasea") {
            let lunaseadevice = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice

            try {
                if (heartbeatJSON == null) {
                    let testdata = {
                        "title": "Uptime Kuma Alert",
                        "body": "Testing Successful.",
                    }
                    await axios.post(lunaseadevice, testdata)
                    return okMsg;
                }

                if (heartbeatJSON["status"] == 0) {
                    let downdata = {
                        "title": "UptimeKuma Alert: " + monitorJSON["name"],
                        "body": "[🔴 Down]" + heartbeatJSON["msg"] + "\nTime (UTC):" + heartbeatJSON["time"],
                    }
                    await axios.post(lunaseadevice, downdata)
                    return okMsg;
                }

                if (heartbeatJSON["status"] == 1) {
                    let updata = {
                        "title": "UptimeKuma Alert: " + monitorJSON["name"],
                        "body": "[✅ Up]" + heartbeatJSON["msg"] + "\nTime (UTC):" + heartbeatJSON["time"],
                    }
                    await axios.post(lunaseadevice, updata)
                    return okMsg;
                }

            } catch (error) {
                throwGeneralAxiosError(error)
            }

        } else if (notification.type === "pushbullet") {
            try {
                let pushbulletUrl = "https://api.pushbullet.com/v2/pushes";
                let config = {
                    headers: {
                        "Access-Token": notification.pushbulletAccessToken,
                        "Content-Type": "application/json"
                    }
                };
                if (heartbeatJSON == null) {
                    let testdata = {
                        "type": "note",
                        "title": "Uptime Kuma Alert",
                        "body": "Testing Successful.",
                    }
                    await axios.post(pushbulletUrl, testdata, config)

Review comment (suggestion):
```suggestion
                        "body": "[✅ Up] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
```

Code after:
            return Notification.apprise(notification, msg)

        } else if (notification.type === "lunasea") {
            let lunaseadevice = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice

            try {
                if (heartbeatJSON == null) {
                    let testdata = {
                        "title": "Uptime Kuma Alert",
                        "body": "Testing Successful.",
                    }
                    await axios.post(lunaseadevice, testdata)
                    return okMsg;
                }

                if (heartbeatJSON["status"] == DOWN) {
                    let downdata = {
                        "title": "UptimeKuma Alert: " + monitorJSON["name"],
                        "body": "[🔴 Down] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
                    }
                    await axios.post(lunaseadevice, downdata)
                    return okMsg;
                }

                if (heartbeatJSON["status"] == UP) {
                    let updata = {
                        "title": "UptimeKuma Alert: " + monitorJSON["name"],
                        "body": "[✅ Up] " + heartbeatJSON["msg"] + "\nTime (UTC): " + heartbeatJSON["time"],
                    }
                    await axios.post(lunaseadevice, updata)
                    return okMsg;
                }

            } catch (error) {
                throwGeneralAxiosError(error)
            }

        } else if (notification.type === "pushbullet") {
            try {
                let pushbulletUrl = "https://api.pushbullet.com/v2/pushes";
                let config = {
                    headers: {
                        "Access-Token": notification.pushbulletAccessToken,
                        "Content-Type": "application/json"
                    }
                };
                if (heartbeatJSON == null) {
                    let testdata = {
                        "type": "note",
                        "title": "Uptime Kuma Alert",
                        "body": "Testing Successful.",