fix linting issues

This commit is contained in:
Nayem Siddique 2025-07-13 20:00:47 +06:00 committed by GitHub
parent 8c97da4a3c
commit f557045fb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,5 @@
const NotificationProvider = require("./notification-provider"); const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
const qs = require("qs");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class LineNotify extends NotificationProvider { class LineNotify extends NotificationProvider {
@ -14,15 +13,16 @@ class LineNotify extends NotificationProvider {
const url = "https://api.line.me/v2/bot/message/broadcast"; const url = "https://api.line.me/v2/bot/message/broadcast";
try { try {
let config = { const config = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: Authorization:
"Bearer " + notification.lineNotifyAccessToken, "Bearer " + notification.lineNotifyAccessToken,
}, },
}; };
if (heartbeatJSON == null) {
let testMessage = { if (!heartbeatJSON) {
const testMessage = {
messages: [ messages: [
{ {
type: "text", type: "text",
@ -32,12 +32,12 @@ class LineNotify extends NotificationProvider {
}; };
await axios.post(url, testMessage, config); await axios.post(url, testMessage, config);
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
let downMessage = { const downMessage = {
messages: [ messages: [
{ {
type: "text", type: "text",
text: text:
`🔴 [Down]\n` + "🔴 [Down]\n" +
`Name: ${monitorJSON["name"]}\n` + `Name: ${monitorJSON["name"]}\n` +
`${heartbeatJSON["msg"]}\n` + `${heartbeatJSON["msg"]}\n` +
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, `Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
@ -46,12 +46,12 @@ class LineNotify extends NotificationProvider {
}; };
await axios.post(url, downMessage, config); await axios.post(url, downMessage, config);
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
let upMessage = { const upMessage = {
messages: [ messages: [
{ {
type: "text", type: "text",
text: text:
`✅ [Up]\n` + "✅ [Up]\n" +
`Name: ${monitorJSON["name"]}\n` + `Name: ${monitorJSON["name"]}\n` +
`${heartbeatJSON["msg"]}\n` + `${heartbeatJSON["msg"]}\n` +
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, `Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,