Merge branch 'master' into better-race-safety

pull/4574/head
Frank Elsinga 2 months ago committed by GitHub
commit 251e30c417
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -8,6 +8,7 @@ const User = require("../server/model/user");
const { io } = require("socket.io-client"); const { io } = require("socket.io-client");
const { localWebSocketURL } = require("../server/config"); const { localWebSocketURL } = require("../server/config");
const args = require("args-parser")(process.argv); const args = require("args-parser")(process.argv);
const rl = readline.createInterface({ const rl = readline.createInterface({
input: process.stdin, input: process.stdin,
output: process.stdout output: process.stdout
@ -19,10 +20,10 @@ const main = async () => {
} }
console.log("Connecting the database"); console.log("Connecting the database");
Database.initDataDir(args);
await Database.connect(false, false, true);
try { try {
Database.initDataDir(args);
await Database.connect(false, false, true);
// No need to actually reset the password for testing, just make sure no connection problem. It is ok for now. // No need to actually reset the password for testing, just make sure no connection problem. It is ok for now.
if (!process.env.TEST_BACKEND) { if (!process.env.TEST_BACKEND) {
const user = await R.findOne("user"); const user = await R.findOne("user");

@ -328,9 +328,9 @@ class Monitor extends BeanModel {
/** /**
* Start monitor * Start monitor
* @param {Server} io Socket server instance * @param {Server} io Socket server instance
* @returns {void} * @returns {Promise<void>}
*/ */
start(io) { async start(io) {
let previousBeat = null; let previousBeat = null;
let retries = 0; let retries = 0;
@ -1102,9 +1102,9 @@ class Monitor extends BeanModel {
/** /**
* Stop monitor * Stop monitor
* @returns {void} * @returns {Promise<void>}
*/ */
stop() { async stop() {
clearTimeout(this.heartbeatInterval); clearTimeout(this.heartbeatInterval);
this.isStop = true; this.isStop = true;

@ -1,5 +1,4 @@
class MonitorType { class MonitorType {
name = undefined; name = undefined;
/** /**

@ -81,7 +81,8 @@ class MqttMonitorType extends MonitorType {
let client = mqtt.connect(mqttUrl, { let client = mqtt.connect(mqttUrl, {
username, username,
password password,
clientId: "uptime-kuma_" + Math.random().toString(16).substr(2, 8)
}); });
client.on("connect", () => { client.on("connect", () => {

@ -3,17 +3,15 @@ const { DOWN, UP } = require("../../src/util");
const axios = require("axios"); const axios = require("axios");
class Alerta extends NotificationProvider { class Alerta extends NotificationProvider {
name = "alerta"; name = "alerta";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let alertaUrl = `${notification.alertaApiEndpoint}`;
let config = { let config = {
headers: { headers: {
"Content-Type": "application/json;charset=UTF-8", "Content-Type": "application/json;charset=UTF-8",
@ -40,7 +38,7 @@ class Alerta extends NotificationProvider {
resource: "Message", resource: "Message",
}, data); }, data);
await axios.post(alertaUrl, postData, config); await axios.post(notification.alertaApiEndpoint, postData, config);
} else { } else {
let datadup = Object.assign( { let datadup = Object.assign( {
correlate: [ "service_up", "service_down" ], correlate: [ "service_up", "service_down" ],
@ -52,11 +50,11 @@ class Alerta extends NotificationProvider {
if (heartbeatJSON["status"] === DOWN) { if (heartbeatJSON["status"] === DOWN) {
datadup.severity = notification.alertaAlertState; // critical datadup.severity = notification.alertaAlertState; // critical
datadup.text = "Service " + monitorJSON["type"] + " is down."; datadup.text = "Service " + monitorJSON["type"] + " is down.";
await axios.post(alertaUrl, datadup, config); await axios.post(notification.alertaApiEndpoint, datadup, config);
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
datadup.severity = notification.alertaRecoverState; // cleaned datadup.severity = notification.alertaRecoverState; // cleaned
datadup.text = "Service " + monitorJSON["type"] + " is up."; datadup.text = "Service " + monitorJSON["type"] + " is up.";
await axios.post(alertaUrl, datadup, config); await axios.post(notification.alertaApiEndpoint, datadup, config);
} }
} }
return okMsg; return okMsg;

@ -4,14 +4,14 @@ const { setting } = require("../util-server");
const { getMonitorRelativeURL, UP, DOWN } = require("../../src/util"); const { getMonitorRelativeURL, UP, DOWN } = require("../../src/util");
class AlertNow extends NotificationProvider { class AlertNow extends NotificationProvider {
name = "AlertNow"; name = "AlertNow";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let textMsg = ""; let textMsg = "";
let status = "open"; let status = "open";

@ -11,7 +11,7 @@ class AliyunSMS extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
if (heartbeatJSON != null) { if (heartbeatJSON != null) {

@ -2,13 +2,14 @@ const NotificationProvider = require("./notification-provider");
const childProcessAsync = require("promisify-child-process"); const childProcessAsync = require("promisify-child-process");
class Apprise extends NotificationProvider { class Apprise extends NotificationProvider {
name = "apprise"; name = "apprise";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const args = [ "-vv", "-b", msg, notification.appriseURL ]; const args = [ "-vv", "-b", msg, notification.appriseURL ];
if (notification.title) { if (notification.title) {
args.push("-t"); args.push("-t");
@ -23,7 +24,7 @@ class Apprise extends NotificationProvider {
if (output) { if (output) {
if (! output.includes("ERROR")) { if (! output.includes("ERROR")) {
return "Sent Successfully"; return okMsg;
} }
throw new Error(output); throw new Error(output);

@ -46,29 +46,29 @@ class Bark extends NotificationProvider {
} }
/** /**
* Add additional parameter for Bark v1 endpoints * Add additional parameter for Bark v1 endpoints.
* Leads to better on device styles (iOS 15 optimized)
* @param {BeanModel} notification Notification to send * @param {BeanModel} notification Notification to send
* @param {string} postUrl URL to append parameters to
* @returns {string} Additional URL parameters * @returns {string} Additional URL parameters
*/ */
appendAdditionalParameters(notification, postUrl) { additionalParameters(notification) {
// set icon to uptime kuma icon, 11kb should be fine // set icon to uptime kuma icon, 11kb should be fine
postUrl += "?icon=" + barkNotificationAvatar; let params = "?icon=" + barkNotificationAvatar;
// grouping all our notifications // grouping all our notifications
if (notification.barkGroup != null) { if (notification.barkGroup != null) {
postUrl += "&group=" + notification.barkGroup; params += "&group=" + notification.barkGroup;
} else { } else {
// default name // default name
postUrl += "&group=" + "UptimeKuma"; params += "&group=" + "UptimeKuma";
} }
// picked a sound, this should follow system's mute status when arrival // picked a sound, this should follow system's mute status when arrival
if (notification.barkSound != null) { if (notification.barkSound != null) {
postUrl += "&sound=" + notification.barkSound; params += "&sound=" + notification.barkSound;
} else { } else {
// default sound // default sound
postUrl += "&sound=" + "telegraph"; params += "&sound=" + "telegraph";
} }
return postUrl; return params;
} }
/** /**
@ -100,9 +100,8 @@ class Bark extends NotificationProvider {
// url encode title and subtitle // url encode title and subtitle
title = encodeURIComponent(title); title = encodeURIComponent(title);
subtitle = encodeURIComponent(subtitle); subtitle = encodeURIComponent(subtitle);
let postUrl = endpoint + "/" + title + "/" + subtitle; const params = this.additionalParameters(notification);
postUrl = this.appendAdditionalParameters(notification, postUrl); result = await axios.get(`${endpoint}/${title}/${subtitle}${params}`);
result = await axios.get(postUrl);
} else { } else {
result = await axios.post(`${endpoint}/push`, { result = await axios.post(`${endpoint}/push`, {
title, title,

@ -2,14 +2,15 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class ClickSendSMS extends NotificationProvider { class ClickSendSMS extends NotificationProvider {
name = "clicksendsms"; name = "clicksendsms";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://rest.clicksend.com/v3/sms/send";
try { try {
let config = { let config = {
headers: { headers: {
@ -28,7 +29,7 @@ class ClickSendSMS extends NotificationProvider {
} }
] ]
}; };
let resp = await axios.post("https://rest.clicksend.com/v3/sms/send", data, config); let resp = await axios.post(url, data, config);
if (resp.data.data.messages[0].status !== "SUCCESS") { if (resp.data.data.messages[0].status !== "SUCCESS") {
let error = "Something gone wrong. Api returned " + resp.data.data.messages[0].status + "."; let error = "Something gone wrong. Api returned " + resp.data.data.messages[0].status + ".";
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

@ -10,7 +10,7 @@ class DingDing extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
if (heartbeatJSON != null) { if (heartbeatJSON != null) {

@ -3,14 +3,13 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class Discord extends NotificationProvider { class Discord extends NotificationProvider {
name = "discord"; name = "discord";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
const discordDisplayName = notification.discordUsername || "Uptime Kuma"; const discordDisplayName = notification.discordUsername || "Uptime Kuma";

@ -9,8 +9,7 @@ class Feishu extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
let feishuWebHookUrl = notification.feishuWebHookUrl;
try { try {
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
@ -20,7 +19,7 @@ class Feishu extends NotificationProvider {
text: msg, text: msg,
}, },
}; };
await axios.post(feishuWebHookUrl, testdata); await axios.post(notification.feishuWebHookUrl, testdata);
return okMsg; return okMsg;
} }
@ -46,7 +45,7 @@ class Feishu extends NotificationProvider {
}, },
}, },
}; };
await axios.post(feishuWebHookUrl, downdata); await axios.post(notification.feishuWebHookUrl, downdata);
return okMsg; return okMsg;
} }
@ -72,7 +71,7 @@ class Feishu extends NotificationProvider {
}, },
}, },
}; };
await axios.post(feishuWebHookUrl, updata); await axios.post(notification.feishuWebHookUrl, updata);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {

@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class FreeMobile extends NotificationProvider { class FreeMobile extends NotificationProvider {
name = "FreeMobile"; name = "FreeMobile";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
await axios.post(`https://smsapi.free-mobile.fr/sendmsg?msg=${encodeURIComponent(msg.replace("🔴", "⛔️"))}`, { await axios.post(`https://smsapi.free-mobile.fr/sendmsg?msg=${encodeURIComponent(msg.replace("🔴", "⛔️"))}`, {
"user": notification.freemobileUser, "user": notification.freemobileUser,

@ -3,21 +3,20 @@ const axios = require("axios");
const { UP } = require("../../src/util"); const { UP } = require("../../src/util");
class GoAlert extends NotificationProvider { class GoAlert extends NotificationProvider {
name = "GoAlert"; name = "GoAlert";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let closeAction = "close";
let data = { let data = {
summary: msg, summary: msg,
}; };
if (heartbeatJSON != null && heartbeatJSON["status"] === UP) { if (heartbeatJSON != null && heartbeatJSON["status"] === UP) {
data["action"] = closeAction; data["action"] = "close";
} }
let headers = { let headers = {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
@ -27,7 +26,6 @@ class GoAlert extends NotificationProvider {
}; };
await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config); await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
let msg = (error.response.data) ? error.response.data : "Error without response"; let msg = (error.response.data) ? error.response.data : "Error without response";
throw new Error(msg); throw new Error(msg);

@ -5,14 +5,14 @@ const { getMonitorRelativeURL } = require("../../src/util");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class GoogleChat extends NotificationProvider { class GoogleChat extends NotificationProvider {
name = "GoogleChat"; name = "GoogleChat";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
// Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic // Google Chat message formatting: https://developers.google.com/chat/api/guides/message-formats/basic

@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Gorush extends NotificationProvider { class Gorush extends NotificationProvider {
name = "gorush"; name = "gorush";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
let platformMapping = { let platformMapping = {
"ios": 1, "ios": 1,

@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Gotify extends NotificationProvider { class Gotify extends NotificationProvider {
name = "gotify"; name = "gotify";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
if (notification.gotifyserverurl && notification.gotifyserverurl.endsWith("/")) { if (notification.gotifyserverurl && notification.gotifyserverurl.endsWith("/")) {
notification.gotifyserverurl = notification.gotifyserverurl.slice(0, -1); notification.gotifyserverurl = notification.gotifyserverurl.slice(0, -1);

@ -3,19 +3,18 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class GrafanaOncall extends NotificationProvider { class GrafanaOncall extends NotificationProvider {
name = "GrafanaOncall"; name = "GrafanaOncall";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
if (!notification.GrafanaOncallURL) { if (!notification.GrafanaOncallURL) {
throw new Error("GrafanaOncallURL cannot be empty"); throw new Error("GrafanaOncallURL cannot be empty");
} }
let okMsg = "Sent Successfully.";
try { try {
if (heartbeatJSON === null) { if (heartbeatJSON === null) {
let grafanaupdata = { let grafanaupdata = {
@ -23,10 +22,7 @@ class GrafanaOncall extends NotificationProvider {
message: msg, message: msg,
state: "alerting", state: "alerting",
}; };
await axios.post( await axios.post(notification.GrafanaOncallURL, grafanaupdata);
notification.GrafanaOncallURL,
grafanaupdata
);
return okMsg; return okMsg;
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
let grafanadowndata = { let grafanadowndata = {
@ -34,10 +30,7 @@ class GrafanaOncall extends NotificationProvider {
message: heartbeatJSON["msg"], message: heartbeatJSON["msg"],
state: "alerting", state: "alerting",
}; };
await axios.post( await axios.post(notification.GrafanaOncallURL, grafanadowndata);
notification.GrafanaOncallURL,
grafanadowndata
);
return okMsg; return okMsg;
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
let grafanaupdata = { let grafanaupdata = {
@ -45,10 +38,7 @@ class GrafanaOncall extends NotificationProvider {
message: heartbeatJSON["msg"], message: heartbeatJSON["msg"],
state: "ok", state: "ok",
}; };
await axios.post( await axios.post(notification.GrafanaOncallURL, grafanaupdata);
notification.GrafanaOncallURL,
grafanaupdata
);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {

@ -0,0 +1,52 @@
const { UP, DOWN, getMonitorRelativeURL } = require("../../src/util");
const { setting } = require("../util-server");
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class HeiiOnCall extends NotificationProvider {
name = "HeiiOnCall";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const payload = heartbeatJSON || {};
const baseURL = await setting("primaryBaseURL");
if (baseURL && monitorJSON) {
payload["url"] = baseURL + getMonitorRelativeURL(monitorJSON.id);
}
const config = {
headers: {
Accept: "application/json",
"Content-Type": "application/json",
Authorization: "Bearer " + notification.heiiOnCallApiKey,
},
};
const heiiUrl = `https://heiioncall.com/triggers/${notification.heiiOnCallTriggerId}/`;
// docs https://heiioncall.com/docs#manual-triggers
try {
if (!heartbeatJSON) {
// Testing or general notification like certificate expiry
payload["msg"] = msg;
await axios.post(heiiUrl + "alert", payload, config);
return okMsg;
}
if (heartbeatJSON.status === DOWN) {
await axios.post(heiiUrl + "alert", payload, config);
return okMsg;
}
if (heartbeatJSON.status === UP) {
await axios.post(heiiUrl + "resolve", payload, config);
return okMsg;
}
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = HeiiOnCall;

@ -9,7 +9,9 @@ class HomeAssistant extends NotificationProvider {
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, message, monitor = null, heartbeat = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const notificationService = notification?.notificationService || defaultNotificationService; const notificationService = notification?.notificationService || defaultNotificationService;
try { try {
@ -17,10 +19,10 @@ class HomeAssistant extends NotificationProvider {
`${notification.homeAssistantUrl.trim().replace(/\/*$/, "")}/api/services/notify/${notificationService}`, `${notification.homeAssistantUrl.trim().replace(/\/*$/, "")}/api/services/notify/${notificationService}`,
{ {
title: "Uptime Kuma", title: "Uptime Kuma",
message, message: msg,
...(notificationService !== "persistent_notification" && { data: { ...(notificationService !== "persistent_notification" && { data: {
name: monitor?.name, name: monitorJSON?.name,
status: heartbeat?.status, status: heartbeatJSON?.status,
} }), } }),
}, },
{ {
@ -31,7 +33,7 @@ class HomeAssistant extends NotificationProvider {
} }
); );
return "Sent Successfully."; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);
} }

@ -2,15 +2,15 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Kook extends NotificationProvider { class Kook extends NotificationProvider {
name = "Kook"; name = "Kook";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
let url = "https://www.kookapp.cn/api/v3/message/create"; const url = "https://www.kookapp.cn/api/v3/message/create";
let data = { let data = {
target_id: notification.kookGuildID, target_id: notification.kookGuildID,
content: msg, content: msg,

@ -3,16 +3,16 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class Line extends NotificationProvider { class Line extends NotificationProvider {
name = "line"; name = "line";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://api.line.me/v2/bot/message/push";
try { try {
let lineAPIUrl = "https://api.line.me/v2/bot/message/push";
let config = { let config = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -29,7 +29,7 @@ class Line extends NotificationProvider {
} }
] ]
}; };
await axios.post(lineAPIUrl, testMessage, config); await axios.post(url, testMessage, config);
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
let downMessage = { let downMessage = {
"to": notification.lineUserID, "to": notification.lineUserID,
@ -43,7 +43,7 @@ class Line extends NotificationProvider {
} }
] ]
}; };
await axios.post(lineAPIUrl, downMessage, config); await axios.post(url, downMessage, config);
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
let upMessage = { let upMessage = {
"to": notification.lineUserID, "to": notification.lineUserID,
@ -57,7 +57,7 @@ class Line extends NotificationProvider {
} }
] ]
}; };
await axios.post(lineAPIUrl, upMessage, config); await axios.post(url, upMessage, config);
} }
return okMsg; return okMsg;
} catch (error) { } catch (error) {

@ -4,16 +4,16 @@ const qs = require("qs");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class LineNotify extends NotificationProvider { class LineNotify extends NotificationProvider {
name = "LineNotify"; name = "LineNotify";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://notify-api.line.me/api/notify";
try { try {
let lineAPIUrl = "https://notify-api.line.me/api/notify";
let config = { let config = {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
@ -24,7 +24,7 @@ class LineNotify extends NotificationProvider {
let testMessage = { let testMessage = {
"message": msg, "message": msg,
}; };
await axios.post(lineAPIUrl, qs.stringify(testMessage), config); await axios.post(url, qs.stringify(testMessage), config);
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
let downMessage = { let downMessage = {
"message": "\n[🔴 Down]\n" + "message": "\n[🔴 Down]\n" +
@ -32,7 +32,7 @@ class LineNotify extends NotificationProvider {
heartbeatJSON["msg"] + "\n" + heartbeatJSON["msg"] + "\n" +
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` `Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}; };
await axios.post(lineAPIUrl, qs.stringify(downMessage), config); await axios.post(url, qs.stringify(downMessage), config);
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
let upMessage = { let upMessage = {
"message": "\n[✅ Up]\n" + "message": "\n[✅ Up]\n" +
@ -40,7 +40,7 @@ class LineNotify extends NotificationProvider {
heartbeatJSON["msg"] + "\n" + heartbeatJSON["msg"] + "\n" +
`Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` `Time (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}; };
await axios.post(lineAPIUrl, qs.stringify(upMessage), config); await axios.post(url, qs.stringify(upMessage), config);
} }
return okMsg; return okMsg;
} catch (error) { } catch (error) {

@ -3,28 +3,23 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class LunaSea extends NotificationProvider { class LunaSea extends NotificationProvider {
name = "lunasea"; name = "lunasea";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
let lunaseaurl = ""; const url = "https://notify.lunasea.app/v1";
if (notification.lunaseaTarget === "user") {
lunaseaurl = "https://notify.lunasea.app/v1/custom/user/" + notification.lunaseaUserID;
} else {
lunaseaurl = "https://notify.lunasea.app/v1/custom/device/" + notification.lunaseaDevice;
}
try { try {
const target = this.getTarget(notification);
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let testdata = { let testdata = {
"title": "Uptime Kuma Alert", "title": "Uptime Kuma Alert",
"body": msg, "body": msg,
}; };
await axios.post(lunaseaurl, testdata); await axios.post(`${url}/custom/${target}`, testdata);
return okMsg; return okMsg;
} }
@ -35,7 +30,7 @@ class LunaSea extends NotificationProvider {
heartbeatJSON["msg"] + heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}; };
await axios.post(lunaseaurl, downdata); await axios.post(`${url}/custom/${target}`, downdata);
return okMsg; return okMsg;
} }
@ -46,13 +41,25 @@ class LunaSea extends NotificationProvider {
heartbeatJSON["msg"] + heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}` `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`
}; };
await axios.post(lunaseaurl, updata); await axios.post(`${url}/custom/${target}`, updata);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);
} }
}
/**
* Generates the lunasea target to send the notification to
* @param {BeanModel} notification Notification details
* @returns {string} The target to send the notification to
*/
getTarget(notification) {
if (notification.lunaseaTarget === "user") {
return "user/" + notification.lunaseaUserID;
}
return "device/" + notification.lunaseaDevice;
} }
} }

@ -10,7 +10,7 @@ class Matrix extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const size = 20; const size = 20;
const randomString = encodeURIComponent( const randomString = encodeURIComponent(

@ -3,14 +3,14 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class Mattermost extends NotificationProvider { class Mattermost extends NotificationProvider {
name = "mattermost"; name = "mattermost";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
const mattermostUserName = notification.mattermostusername || "Uptime Kuma"; const mattermostUserName = notification.mattermostusername || "Uptime Kuma";
// If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing. // If heartbeatJSON is null, assume non monitoring notification (Certificate warning) or testing.
@ -98,10 +98,7 @@ class Mattermost extends NotificationProvider {
}, },
], ],
}; };
await axios.post( await axios.post(notification.mattermostWebhookUrl, mattermostdata);
notification.mattermostWebhookUrl,
mattermostdata
);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

@ -3,14 +3,14 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class Ntfy extends NotificationProvider { class Ntfy extends NotificationProvider {
name = "ntfy"; name = "ntfy";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let headers = {}; let headers = {};
if (notification.ntfyAuthenticationMethod === "usernamePassword") { if (notification.ntfyAuthenticationMethod === "usernamePassword") {
@ -31,7 +31,7 @@ class Ntfy extends NotificationProvider {
"priority": notification.ntfyPriority, "priority": notification.ntfyPriority,
"tags": [ "test_tube" ], "tags": [ "test_tube" ],
}; };
await axios.post(`${notification.ntfyserverurl}`, ntfyTestData, { headers: headers }); await axios.post(notification.ntfyserverurl, ntfyTestData, { headers: headers });
return okMsg; return okMsg;
} }
let tags = []; let tags = [];
@ -54,20 +54,23 @@ class Ntfy extends NotificationProvider {
"priority": priority, "priority": priority,
"title": monitorJSON.name + " " + status + " [Uptime-Kuma]", "title": monitorJSON.name + " " + status + " [Uptime-Kuma]",
"tags": tags, "tags": tags,
"actions": [ };
if (monitorJSON.url && monitorJSON.url !== "https://") {
data.actions = [
{ {
"action": "view", "action": "view",
"label": "Open " + monitorJSON.name, "label": "Open " + monitorJSON.name,
"url": monitorJSON.url, "url": monitorJSON.url,
} },
] ];
}; }
if (notification.ntfyIcon) { if (notification.ntfyIcon) {
data.icon = notification.ntfyIcon; data.icon = notification.ntfyIcon;
} }
await axios.post(`${notification.ntfyserverurl}`, data, { headers: headers }); await axios.post(notification.ntfyserverurl, data, { headers: headers });
return okMsg; return okMsg;

@ -2,14 +2,15 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Octopush extends NotificationProvider { class Octopush extends NotificationProvider {
name = "octopush"; name = "octopush";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const urlV2 = "https://api.octopush.com/v1/public/sms-campaign/send";
const urlV1 = "https://www.octopush-dm.com/api/sms/json";
try { try {
// Default - V2 // Default - V2
@ -33,7 +34,7 @@ class Octopush extends NotificationProvider {
"purpose": "alert", "purpose": "alert",
"sender": notification.octopushSenderName "sender": notification.octopushSenderName
}; };
await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config); await axios.post(urlV2, data, config);
} else if (notification.octopushVersion === "1") { } else if (notification.octopushVersion === "1") {
let data = { let data = {
"user_login": notification.octopushDMLogin, "user_login": notification.octopushDMLogin,
@ -55,7 +56,7 @@ class Octopush extends NotificationProvider {
// V1 API returns 200 even on error so we must check // V1 API returns 200 even on error so we must check
// response data // response data
let response = await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config); let response = await axios.post(urlV1, {}, config);
if ("error_code" in response.data) { if ("error_code" in response.data) {
if (response.data.error_code !== "000") { if (response.data.error_code !== "000") {
this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`); this.throwGeneralAxiosError(`Octopush error ${JSON.stringify(response.data)}`);

@ -2,23 +2,23 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class OneBot extends NotificationProvider { class OneBot extends NotificationProvider {
name = "OneBot"; name = "OneBot";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let httpAddr = notification.httpAddr; let url = notification.httpAddr;
if (!httpAddr.startsWith("http")) { if (!url.startsWith("http")) {
httpAddr = "http://" + httpAddr; url = "http://" + url;
} }
if (!httpAddr.endsWith("/")) { if (!url.endsWith("/")) {
httpAddr += "/"; url += "/";
} }
let onebotAPIUrl = httpAddr + "send_msg"; url += "send_msg";
let config = { let config = {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -37,7 +37,7 @@ class OneBot extends NotificationProvider {
data["message_type"] = "private"; data["message_type"] = "private";
data["user_id"] = notification.recieverId; data["user_id"] = notification.recieverId;
} }
await axios.post(onebotAPIUrl, data, config); await axios.post(url, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

@ -4,10 +4,9 @@ const { UP, DOWN } = require("../../src/util");
const opsgenieAlertsUrlEU = "https://api.eu.opsgenie.com/v2/alerts"; const opsgenieAlertsUrlEU = "https://api.eu.opsgenie.com/v2/alerts";
const opsgenieAlertsUrlUS = "https://api.opsgenie.com/v2/alerts"; const opsgenieAlertsUrlUS = "https://api.opsgenie.com/v2/alerts";
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
class Opsgenie extends NotificationProvider { class Opsgenie extends NotificationProvider {
name = "Opsgenie"; name = "Opsgenie";
/** /**

@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class PromoSMS extends NotificationProvider { class PromoSMS extends NotificationProvider {
name = "promosms"; name = "promosms";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://promosms.com/api/rest/v3_2/sms";
if (notification.promosmsAllowLongSMS === undefined) { if (notification.promosmsAllowLongSMS === undefined) {
notification.promosmsAllowLongSMS = false; notification.promosmsAllowLongSMS = false;
@ -36,7 +36,7 @@ class PromoSMS extends NotificationProvider {
"sender": notification.promosmsSenderName "sender": notification.promosmsSenderName
}; };
let resp = await axios.post("https://promosms.com/api/rest/v3_2/sms", data, config); let resp = await axios.post(url, data, config);
if (resp.data.response.status !== 0) { if (resp.data.response.status !== 0) {
let error = "Something gone wrong. Api returned " + resp.data.response.status + "."; let error = "Something gone wrong. Api returned " + resp.data.response.status + ".";

@ -4,17 +4,16 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class Pushbullet extends NotificationProvider { class Pushbullet extends NotificationProvider {
name = "pushbullet"; name = "pushbullet";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://api.pushbullet.com/v2/pushes";
try { try {
let pushbulletUrl = "https://api.pushbullet.com/v2/pushes";
let config = { let config = {
headers: { headers: {
"Access-Token": notification.pushbulletAccessToken, "Access-Token": notification.pushbulletAccessToken,
@ -27,7 +26,7 @@ class Pushbullet extends NotificationProvider {
"title": "Uptime Kuma Alert", "title": "Uptime Kuma Alert",
"body": msg, "body": msg,
}; };
await axios.post(pushbulletUrl, data, config); await axios.post(url, data, config);
} else if (heartbeatJSON["status"] === DOWN) { } else if (heartbeatJSON["status"] === DOWN) {
let downData = { let downData = {
"type": "note", "type": "note",
@ -36,7 +35,7 @@ class Pushbullet extends NotificationProvider {
heartbeatJSON["msg"] + heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
}; };
await axios.post(pushbulletUrl, downData, config); await axios.post(url, downData, config);
} else if (heartbeatJSON["status"] === UP) { } else if (heartbeatJSON["status"] === UP) {
let upData = { let upData = {
"type": "note", "type": "note",
@ -45,7 +44,7 @@ class Pushbullet extends NotificationProvider {
heartbeatJSON["msg"] + heartbeatJSON["msg"] +
`\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`, `\nTime (${heartbeatJSON["timezone"]}): ${heartbeatJSON["localDateTime"]}`,
}; };
await axios.post(pushbulletUrl, upData, config); await axios.post(url, upData, config);
} }
return okMsg; return okMsg;
} catch (error) { } catch (error) {

@ -3,17 +3,15 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class PushDeer extends NotificationProvider { class PushDeer extends NotificationProvider {
name = "PushDeer"; name = "PushDeer";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
let endpoint = "/message/push"; const serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com";
let serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com"; const url = `${serverUrl.trim().replace(/\/*$/, "")}/message/push`;
let pushdeerlink = `${serverUrl.trim().replace(/\/*$/, "")}${endpoint}`;
let valid = msg != null && monitorJSON != null && heartbeatJSON != null; let valid = msg != null && monitorJSON != null && heartbeatJSON != null;
@ -34,7 +32,7 @@ class PushDeer extends NotificationProvider {
}; };
try { try {
let res = await axios.post(pushdeerlink, data); let res = await axios.post(url, data);
if ("error" in res.data) { if ("error" in res.data) {
let error = res.data.error; let error = res.data.error;

@ -2,15 +2,14 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Pushover extends NotificationProvider { class Pushover extends NotificationProvider {
name = "pushover"; name = "pushover";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
let pushoverlink = "https://api.pushover.net/1/messages.json"; const url = "https://api.pushover.net/1/messages.json";
let data = { let data = {
"message": msg, "message": msg,
@ -33,11 +32,11 @@ class Pushover extends NotificationProvider {
try { try {
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
await axios.post(pushoverlink, data); await axios.post(url, data);
return okMsg; return okMsg;
} else { } else {
data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>:${heartbeatJSON["localDateTime"]}`; data.message += `\n<b>Time (${heartbeatJSON["timezone"]})</b>:${heartbeatJSON["localDateTime"]}`;
await axios.post(pushoverlink, data); await axios.post(url, data);
return okMsg; return okMsg;
} }
} catch (error) { } catch (error) {

@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Pushy extends NotificationProvider { class Pushy extends NotificationProvider {
name = "pushy"; name = "pushy";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
await axios.post(`https://api.pushy.me/push?api_key=${notification.pushyAPIKey}`, { await axios.post(`https://api.pushy.me/push?api_key=${notification.pushyAPIKey}`, {

@ -5,14 +5,14 @@ const { setting } = require("../util-server");
const { getMonitorRelativeURL, DOWN } = require("../../src/util"); const { getMonitorRelativeURL, DOWN } = require("../../src/util");
class RocketChat extends NotificationProvider { class RocketChat extends NotificationProvider {
name = "rocket.chat"; name = "rocket.chat";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
let data = { let data = {

@ -3,14 +3,14 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class ServerChan extends NotificationProvider { class ServerChan extends NotificationProvider {
name = "ServerChan"; name = "ServerChan";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
await axios.post(`https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`, { await axios.post(`https://sctapi.ftqq.com/${notification.serverChanSendKey}.send`, {
"title": this.checkStatus(heartbeatJSON, monitorJSON), "title": this.checkStatus(heartbeatJSON, monitorJSON),

@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class SerwerSMS extends NotificationProvider { class SerwerSMS extends NotificationProvider {
name = "serwersms"; name = "serwersms";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://api2.serwersms.pl/messages/send_sms";
try { try {
let config = { let config = {
@ -25,7 +25,7 @@ class SerwerSMS extends NotificationProvider {
"sender": notification.serwersmsSenderName, "sender": notification.serwersmsSenderName,
}; };
let resp = await axios.post("https://api2.serwersms.pl/messages/send_sms", data, config); let resp = await axios.post(url, data, config);
if (!resp.data.success) { if (!resp.data.success) {
if (resp.data.error) { if (resp.data.error) {

@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Signal extends NotificationProvider { class Signal extends NotificationProvider {
name = "signal"; name = "signal";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let data = { let data = {

@ -4,7 +4,6 @@ const { setSettings, setting } = require("../util-server");
const { getMonitorRelativeURL, UP } = require("../../src/util"); const { getMonitorRelativeURL, UP } = require("../../src/util");
class Slack extends NotificationProvider { class Slack extends NotificationProvider {
name = "slack"; name = "slack";
/** /**
@ -31,7 +30,7 @@ class Slack extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
if (notification.slackchannelnotify) { if (notification.slackchannelnotify) {
msg += " <!channel>"; msg += " <!channel>";

@ -8,7 +8,9 @@ class SMSC extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://smsc.kz/sys/send.php?";
try { try {
let config = { let config = {
headers: { headers: {
@ -29,7 +31,7 @@ class SMSC extends NotificationProvider {
getArray.push("sender=" + notification.smscSenderName); getArray.push("sender=" + notification.smscSenderName);
} }
let resp = await axios.get("https://smsc.kz/sys/send.php?" + getArray.join("&"), config); let resp = await axios.get(url + getArray.join("&"), config);
if (resp.data.id === undefined) { if (resp.data.id === undefined) {
let error = `Something gone wrong. Api returned code ${resp.data.error_code}: ${resp.data.error}`; let error = `Something gone wrong. Api returned code ${resp.data.error_code}: ${resp.data.error}`;
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class SMSEagle extends NotificationProvider { class SMSEagle extends NotificationProvider {
name = "SMSEagle"; name = "SMSEagle";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let config = { let config = {

@ -2,23 +2,24 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class SMSManager extends NotificationProvider { class SMSManager extends NotificationProvider {
name = "SMSManager"; name = "SMSManager";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const url = "https://http-api.smsmanager.cz/Send";
try { try {
let data = { let data = {
apikey: notification.smsmanagerApiKey, apikey: notification.smsmanagerApiKey,
endpoint: "https://http-api.smsmanager.cz/Send",
message: msg.replace(/[^\x00-\x7F]/g, ""), message: msg.replace(/[^\x00-\x7F]/g, ""),
to: notification.numbers, number: notification.numbers,
messageType: notification.messageType, gateway: notification.messageType,
}; };
await axios.get(`${data.endpoint}?apikey=${data.apikey}&message=${data.message}&number=${data.to}&gateway=${data.messageType}`); await axios.get(`${url}?apikey=${data.apikey}&message=${data.message}&number=${data.number}&gateway=${data.messageType}`);
return "SMS sent sucessfully."; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);
} }

@ -4,13 +4,13 @@ const { DOWN } = require("../../src/util");
const { Liquid } = require("liquidjs"); const { Liquid } = require("liquidjs");
class SMTP extends NotificationProvider { class SMTP extends NotificationProvider {
name = "smtp"; name = "smtp";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const config = { const config = {
host: notification.smtpHost, host: notification.smtpHost,
@ -76,7 +76,7 @@ class SMTP extends NotificationProvider {
text: body, text: body,
}); });
return "Sent Successfully."; return okMsg;
} }
/** /**

@ -3,14 +3,13 @@ const axios = require("axios");
const { DOWN } = require("../../src/util"); const { DOWN } = require("../../src/util");
class Squadcast extends NotificationProvider { class Squadcast extends NotificationProvider {
name = "squadcast"; name = "squadcast";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {

@ -4,14 +4,14 @@ const { setting } = require("../util-server");
const { getMonitorRelativeURL } = require("../../src/util"); const { getMonitorRelativeURL } = require("../../src/util");
class Stackfield extends NotificationProvider { class Stackfield extends NotificationProvider {
name = "stackfield"; name = "stackfield";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
// Stackfield message formatting: https://www.stackfield.com/help/formatting-messages-2001 // Stackfield message formatting: https://www.stackfield.com/help/formatting-messages-2001

@ -1,6 +1,7 @@
const NotificationProvider = require("./notification-provider"); const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { setting } = require("../util-server");
const { DOWN, UP, getMonitorRelativeURL } = require("../../src/util");
class Teams extends NotificationProvider { class Teams extends NotificationProvider {
name = "teams"; name = "teams";
@ -9,89 +10,172 @@ class Teams extends NotificationProvider {
* Generate the message to send * Generate the message to send
* @param {const} status The status constant * @param {const} status The status constant
* @param {string} monitorName Name of monitor * @param {string} monitorName Name of monitor
* @param {boolean} withStatusSymbol If the status should be prepended as symbol
* @returns {string} Status message * @returns {string} Status message
*/ */
_statusMessageFactory = (status, monitorName) => { _statusMessageFactory = (status, monitorName, withStatusSymbol) => {
if (status === DOWN) { if (status === DOWN) {
return `🔴 Application [${monitorName}] went down`; return (withStatusSymbol ? "🔴 " : "") + `[${monitorName}] went down`;
} else if (status === UP) { } else if (status === UP) {
return `✅ Application [${monitorName}] is back online`; return (withStatusSymbol ? "✅ " : "") + `[${monitorName}] is back online`;
} }
return "Notification"; return "Notification";
}; };
/** /**
* Select theme color to use based on status * Select the style to use based on status
* @param {const} status The status constant * @param {const} status The status constant
* @returns {string} Selected color in hex RGB format * @returns {string} Selected style for adaptive cards
*/ */
_getThemeColor = (status) => { _getStyle = (status) => {
if (status === DOWN) { if (status === DOWN) {
return "ff0000"; return "attention";
} }
if (status === UP) { if (status === UP) {
return "00e804"; return "good";
} }
return "008cff"; return "emphasis";
}; };
/** /**
* Generate payload for notification * Generate payload for notification
* @param {object} args Method arguments * @param {object} args Method arguments
* @param {const} args.status The status of the monitor * @param {object} args.heartbeatJSON Heartbeat details
* @param {string} args.monitorMessage Message to send * @param {string} args.monitorName Name of the monitor affected
* @param {string} args.monitorName Name of monitor affected * @param {string} args.monitorUrl URL of the monitor affected
* @param {string} args.monitorUrl URL of monitor affected * @param {string} args.dashboardUrl URL of the dashboard affected
* @returns {object} Notification payload * @returns {object} Notification payload
*/ */
_notificationPayloadFactory = ({ _notificationPayloadFactory = ({
status, heartbeatJSON,
monitorMessage,
monitorName, monitorName,
monitorUrl, monitorUrl,
dashboardUrl,
}) => { }) => {
const notificationMessage = this._statusMessageFactory( const status = heartbeatJSON?.status;
status,
monitorName
);
const facts = []; const facts = [];
const actions = [];
if (dashboardUrl) {
actions.push({
"type": "Action.OpenUrl",
"title": "Visit Uptime Kuma",
"url": dashboardUrl
});
}
if (heartbeatJSON?.msg) {
facts.push({
title: "Description",
value: heartbeatJSON.msg,
});
}
if (monitorName) { if (monitorName) {
facts.push({ facts.push({
name: "Monitor", title: "Monitor",
value: monitorName, value: monitorName,
}); });
} }
if (monitorUrl && monitorUrl !== "https://") { if (monitorUrl && monitorUrl !== "https://") {
facts.push({ facts.push({
name: "URL", title: "URL",
value: monitorUrl, // format URL as markdown syntax, to be clickable
value: `[${monitorUrl}](${monitorUrl})`,
});
actions.push({
"type": "Action.OpenUrl",
"title": "Visit Monitor URL",
"url": monitorUrl
}); });
} }
return { if (heartbeatJSON?.localDateTime) {
"@context": "https://schema.org/extensions", facts.push({
"@type": "MessageCard", title: "Time",
themeColor: this._getThemeColor(status), value: heartbeatJSON.localDateTime + (heartbeatJSON.timezone ? ` (${heartbeatJSON.timezone})` : ""),
summary: notificationMessage, });
sections: [ }
{
activityImage: const payload = {
"https://raw.githubusercontent.com/louislam/uptime-kuma/master/public/icon.png", "type": "message",
activityTitle: "**Uptime Kuma**", // message with status prefix as notification text
}, "summary": this._statusMessageFactory(status, monitorName, true),
{ "attachments": [
activityTitle: notificationMessage,
},
{ {
activityTitle: "**Description**", "contentType": "application/vnd.microsoft.card.adaptive",
text: monitorMessage, "contentUrl": "",
facts, "content": {
}, "type": "AdaptiveCard",
], "body": [
{
"type": "Container",
"verticalContentAlignment": "Center",
"items": [
{
"type": "ColumnSet",
"style": this._getStyle(status),
"columns": [
{
"type": "Column",
"width": "auto",
"verticalContentAlignment": "Center",
"items": [
{
"type": "Image",
"width": "32px",
"style": "Person",
"url": "https://raw.githubusercontent.com/louislam/uptime-kuma/master/public/icon.png",
"altText": "Uptime Kuma Logo"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": `**${this._statusMessageFactory(status, monitorName, false)}**`,
},
{
"type": "TextBlock",
"size": "Small",
"weight": "Default",
"text": "Uptime Kuma Alert",
"isSubtle": true,
"spacing": "None"
}
]
}
]
}
]
},
{
"type": "FactSet",
"separator": false,
"facts": facts
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5"
}
}
]
}; };
if (actions) {
payload.attachments[0].content.body.push({
"type": "ActionSet",
"actions": actions,
});
}
return payload;
}; };
/** /**
@ -112,7 +196,9 @@ class Teams extends NotificationProvider {
*/ */
_handleGeneralNotification = (webhookUrl, msg) => { _handleGeneralNotification = (webhookUrl, msg) => {
const payload = this._notificationPayloadFactory({ const payload = this._notificationPayloadFactory({
monitorMessage: msg heartbeatJSON: {
msg: msg
}
}); });
return this._sendNotification(webhookUrl, payload); return this._sendNotification(webhookUrl, payload);
@ -122,7 +208,7 @@ class Teams extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
if (heartbeatJSON == null) { if (heartbeatJSON == null) {
@ -130,26 +216,32 @@ class Teams extends NotificationProvider {
return okMsg; return okMsg;
} }
let url; let monitorUrl;
switch (monitorJSON["type"]) { switch (monitorJSON["type"]) {
case "http": case "http":
case "keywork": case "keywork":
url = monitorJSON["url"]; monitorUrl = monitorJSON["url"];
break; break;
case "docker": case "docker":
url = monitorJSON["docker_host"]; monitorUrl = monitorJSON["docker_host"];
break; break;
default: default:
url = monitorJSON["hostname"]; monitorUrl = monitorJSON["hostname"];
break; break;
} }
const baseURL = await setting("primaryBaseURL");
let dashboardUrl;
if (baseURL) {
dashboardUrl = baseURL + getMonitorRelativeURL(monitorJSON.id);
}
const payload = this._notificationPayloadFactory({ const payload = this._notificationPayloadFactory({
monitorMessage: heartbeatJSON.msg, heartbeatJSON: heartbeatJSON,
monitorName: monitorJSON.name, monitorName: monitorJSON.name,
monitorUrl: url, monitorUrl: monitorUrl,
status: heartbeatJSON.status, dashboardUrl: dashboardUrl,
}); });
await this._sendNotification(notification.webhookUrl, payload); await this._sendNotification(notification.webhookUrl, payload);

@ -2,14 +2,13 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class TechulusPush extends NotificationProvider { class TechulusPush extends NotificationProvider {
name = "PushByTechulus"; name = "PushByTechulus";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, { await axios.post(`https://push.techulus.com/api/v1/notify/${notification.pushAPIKey}`, {

@ -2,14 +2,14 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Telegram extends NotificationProvider { class Telegram extends NotificationProvider {
name = "telegram"; name = "telegram";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
const url = "https://api.telegram.org";
try { try {
let params = { let params = {
@ -22,7 +22,7 @@ class Telegram extends NotificationProvider {
params.message_thread_id = notification.telegramMessageThreadID; params.message_thread_id = notification.telegramMessageThreadID;
} }
await axios.get(`https://api.telegram.org/bot${notification.telegramBotToken}/sendMessage`, { await axios.get(`${url}/bot${notification.telegramBotToken}/sendMessage`, {
params: params, params: params,
}); });
return okMsg; return okMsg;

@ -2,26 +2,21 @@ const NotificationProvider = require("./notification-provider");
const axios = require("axios"); const axios = require("axios");
class Twilio extends NotificationProvider { class Twilio extends NotificationProvider {
name = "twilio"; name = "twilio";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
let okMsg = "Sent Successfully."; let apiKey = notification.twilioApiKey ? notification.twilioApiKey : notification.twilioAccountSID;
let accountSID = notification.twilioAccountSID;
let apiKey = notification.twilioApiKey ? notification.twilioApiKey : accountSID;
let authToken = notification.twilioAuthToken;
try { try {
let config = { let config = {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8", "Content-Type": "application/x-www-form-urlencoded;charset=utf-8",
"Authorization": "Basic " + Buffer.from(apiKey + ":" + authToken).toString("base64"), "Authorization": "Basic " + Buffer.from(apiKey + ":" + notification.twilioAuthToken).toString("base64"),
} }
}; };
@ -30,9 +25,7 @@ class Twilio extends NotificationProvider {
data.append("From", notification.twilioFromNumber); data.append("From", notification.twilioFromNumber);
data.append("Body", msg); data.append("Body", msg);
let url = "https://api.twilio.com/2010-04-01/Accounts/" + accountSID + "/Messages.json"; await axios.post(`https://api.twilio.com/2010-04-01/Accounts/${(notification.twilioAccountSID)}/Messages.json`, data, config);
await axios.post(url, data, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {

@ -4,14 +4,13 @@ const FormData = require("form-data");
const { Liquid } = require("liquidjs"); const { Liquid } = require("liquidjs");
class Webhook extends NotificationProvider { class Webhook extends NotificationProvider {
name = "webhook"; name = "webhook";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let data = { let data = {

@ -3,24 +3,22 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class WeCom extends NotificationProvider { class WeCom extends NotificationProvider {
name = "WeCom"; name = "WeCom";
/** /**
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
let WeComUrl = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=" + notification.weComBotKey;
let config = { let config = {
headers: { headers: {
"Content-Type": "application/json" "Content-Type": "application/json"
} }
}; };
let body = this.composeMessage(heartbeatJSON, msg); let body = this.composeMessage(heartbeatJSON, msg);
await axios.post(WeComUrl, body, config); await axios.post(`https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${notification.weComBotKey}`, body, config);
return okMsg; return okMsg;
} catch (error) { } catch (error) {
this.throwGeneralAxiosError(error); this.throwGeneralAxiosError(error);

@ -3,7 +3,6 @@ const axios = require("axios");
const { DOWN, UP } = require("../../src/util"); const { DOWN, UP } = require("../../src/util");
class ZohoCliq extends NotificationProvider { class ZohoCliq extends NotificationProvider {
name = "ZohoCliq"; name = "ZohoCliq";
/** /**
@ -80,7 +79,7 @@ class ZohoCliq extends NotificationProvider {
* @inheritdoc * @inheritdoc
*/ */
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
let okMsg = "Sent Successfully."; const okMsg = "Sent Successfully.";
try { try {
if (heartbeatJSON == null) { if (heartbeatJSON == null) {

@ -16,6 +16,7 @@ const Gorush = require("./notification-providers/gorush");
const Gotify = require("./notification-providers/gotify"); const Gotify = require("./notification-providers/gotify");
const GrafanaOncall = require("./notification-providers/grafana-oncall"); const GrafanaOncall = require("./notification-providers/grafana-oncall");
const HomeAssistant = require("./notification-providers/home-assistant"); const HomeAssistant = require("./notification-providers/home-assistant");
const HeiiOnCall = require("./notification-providers/heii-oncall");
const Kook = require("./notification-providers/kook"); const Kook = require("./notification-providers/kook");
const Line = require("./notification-providers/line"); const Line = require("./notification-providers/line");
const LineNotify = require("./notification-providers/linenotify"); const LineNotify = require("./notification-providers/linenotify");
@ -87,6 +88,7 @@ class Notification {
new Gotify(), new Gotify(),
new GrafanaOncall(), new GrafanaOncall(),
new HomeAssistant(), new HomeAssistant(),
new HeiiOnCall(),
new Kook(), new Kook(),
new Line(), new Line(),
new LineNotify(), new LineNotify(),

@ -986,7 +986,7 @@ let needSetup = false;
log.info("manage", `Delete Monitor: ${monitorID} User ID: ${socket.userID}`); log.info("manage", `Delete Monitor: ${monitorID} User ID: ${socket.userID}`);
if (monitorID in server.monitorList) { if (monitorID in server.monitorList) {
server.monitorList[monitorID].stop(); await server.monitorList[monitorID].stop();
delete server.monitorList[monitorID]; delete server.monitorList[monitorID];
} }
@ -1703,11 +1703,11 @@ async function startMonitor(userID, monitorID) {
]); ]);
if (monitor.id in server.monitorList) { if (monitor.id in server.monitorList) {
server.monitorList[monitor.id].stop(); await server.monitorList[monitor.id].stop();
} }
server.monitorList[monitor.id] = monitor; server.monitorList[monitor.id] = monitor;
monitor.start(io); await monitor.start(io);
} }
/** /**
@ -1737,7 +1737,7 @@ async function pauseMonitor(userID, monitorID) {
]); ]);
if (monitorID in server.monitorList) { if (monitorID in server.monitorList) {
server.monitorList[monitorID].stop(); await server.monitorList[monitorID].stop();
server.monitorList[monitorID].active = 0; server.monitorList[monitorID].active = 0;
} }
} }
@ -1754,7 +1754,7 @@ async function startMonitors() {
} }
for (let monitor of list) { for (let monitor of list) {
monitor.start(io); await monitor.start(io);
// Give some delays, so all monitors won't make request at the same moment when just start the server. // Give some delays, so all monitors won't make request at the same moment when just start the server.
await sleep(getRandomInt(300, 1000)); await sleep(getRandomInt(300, 1000));
} }
@ -1775,7 +1775,7 @@ async function shutdownFunction(signal) {
log.info("server", "Stopping all monitors"); log.info("server", "Stopping all monitors");
for (let id in server.monitorList) { for (let id in server.monitorList) {
let monitor = server.monitorList[id]; let monitor = server.monitorList[id];
monitor.stop(); await monitor.stop();
} }
await sleep(2000); await sleep(2000);
await Database.close(); await Database.close();

@ -120,6 +120,7 @@ export default {
"gorush": "Gorush", "gorush": "Gorush",
"gotify": "Gotify", "gotify": "Gotify",
"GrafanaOncall": "Grafana Oncall", "GrafanaOncall": "Grafana Oncall",
"HeiiOnCall": "Heii On-Call",
"HomeAssistant": "Home Assistant", "HomeAssistant": "Home Assistant",
"Kook": "Kook", "Kook": "Kook",
"line": "LINE Messenger", "line": "LINE Messenger",

@ -0,0 +1,34 @@
<template>
<div class="mb-3">
<label for="heiioncall-apikey" class="form-label">{{ $t("API Key") }}<span
style="color: red;"
><sup>*</sup></span></label>
<HiddenInput
id="heiioncall-apikey" v-model="$parent.notification.heiiOnCallApiKey" required="true"
autocomplete="false"
></HiddenInput>
</div>
<div class="mb-3">
<label for="heiioncall-trigger-id" class="form-label">Trigger ID<span
style="color: red;"
><sup>*</sup></span></label>
<HiddenInput
id="heiioncall-trigger-id" v-model="$parent.notification.heiiOnCallTriggerId" required="true"
autocomplete="false"
></HiddenInput>
</div>
<i18n-t tag="p" keypath="wayToGetHeiiOnCallDetails" class="form-text mt-3">
<template #documentation>
<a href="https://heiioncall.com/docs" target="_blank">{{ $t("documentationOf", ["Heii On-Call"]) }}</a>
</template>
</i18n-t>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";
export default {
components: {
HiddenInput,
},
};
</script>

@ -1,17 +1,17 @@
<template> <template>
<div class="mb-3"> <div class="mb-3">
<label for="line-channel-access-token" class="form-label">{{ $t("Channel access token") }}</label> <label for="line-channel-access-token" class="form-label">{{ $t("Channel access token (Long-lived)") }}</label>
<HiddenInput id="line-channel-access-token" v-model="$parent.notification.lineChannelAccessToken" :required="true" autocomplete="new-password"></HiddenInput> <HiddenInput id="line-channel-access-token" v-model="$parent.notification.lineChannelAccessToken" :required="true" autocomplete="new-password"></HiddenInput>
</div> </div>
<i18n-t tag="div" keypath="lineDevConsoleTo" class="form-text"> <i18n-t tag="div" keypath="lineDevConsoleTo" class="form-text">
<b>{{ $t("Basic Settings") }}</b> <b>{{ $t("Messaging API") }}</b>
</i18n-t> </i18n-t>
<div class="mb-3" style="margin-top: 12px;"> <div class="mb-3" style="margin-top: 12px;">
<label for="line-user-id" class="form-label">{{ $t("User ID") }}</label> <label for="line-user-id" class="form-label">{{ $t("Your User ID") }}</label>
<input id="line-user-id" v-model="$parent.notification.lineUserID" type="text" class="form-control" required> <input id="line-user-id" v-model="$parent.notification.lineUserID" type="text" class="form-control" required>
</div> </div>
<i18n-t tag="div" keypath="lineDevConsoleTo" class="form-text"> <i18n-t tag="div" keypath="lineDevConsoleTo" class="form-text">
<b>{{ $t("Messaging API") }}</b> <b>{{ $t("Basic Settings") }}</b>
</i18n-t> </i18n-t>
<i18n-t tag="div" keypath="wayToGetLineChannelToken" class="form-text" style="margin-top: 8px;"> <i18n-t tag="div" keypath="wayToGetLineChannelToken" class="form-text" style="margin-top: 8px;">
<a href="https://developers.line.biz/console/" target="_blank">{{ $t("Line Developers Console") }}</a> <a href="https://developers.line.biz/console/" target="_blank">{{ $t("Line Developers Console") }}</a>

@ -14,6 +14,7 @@ import Gorush from "./Gorush.vue";
import Gotify from "./Gotify.vue"; import Gotify from "./Gotify.vue";
import GrafanaOncall from "./GrafanaOncall.vue"; import GrafanaOncall from "./GrafanaOncall.vue";
import HomeAssistant from "./HomeAssistant.vue"; import HomeAssistant from "./HomeAssistant.vue";
import HeiiOnCall from "./HeiiOnCall.vue";
import Kook from "./Kook.vue"; import Kook from "./Kook.vue";
import Line from "./Line.vue"; import Line from "./Line.vue";
import LineNotify from "./LineNotify.vue"; import LineNotify from "./LineNotify.vue";
@ -74,6 +75,7 @@ const NotificationFormList = {
"gotify": Gotify, "gotify": Gotify,
"GrafanaOncall": GrafanaOncall, "GrafanaOncall": GrafanaOncall,
"HomeAssistant": HomeAssistant, "HomeAssistant": HomeAssistant,
"HeiiOnCall": HeiiOnCall,
"Kook": Kook, "Kook": Kook,
"line": Line, "line": Line,
"LineNotify": LineNotify, "LineNotify": LineNotify,

@ -532,10 +532,12 @@
"Recipients": "Recipients", "Recipients": "Recipients",
"Access Token": "Access Token", "Access Token": "Access Token",
"Channel access token": "Channel access token", "Channel access token": "Channel access token",
"Channel access token (Long-lived)": "Channel access token (Long-lived)",
"Line Developers Console": "Line Developers Console", "Line Developers Console": "Line Developers Console",
"lineDevConsoleTo": "Line Developers Console - {0}", "lineDevConsoleTo": "Line Developers Console - {0}",
"Basic Settings": "Basic Settings", "Basic Settings": "Basic Settings",
"User ID": "User ID", "User ID": "User ID",
"Your User ID": "Your user ID",
"Messaging API": "Messaging API", "Messaging API": "Messaging API",
"wayToGetLineChannelToken": "First access the {0}, create a provider and channel (Messaging API), then you can get the channel access token and user ID from the above mentioned menu items.", "wayToGetLineChannelToken": "First access the {0}, create a provider and channel (Messaging API), then you can get the channel access token and user ID from the above mentioned menu items.",
"Icon URL": "Icon URL", "Icon URL": "Icon URL",
@ -883,5 +885,7 @@
"deleteRemoteBrowserMessage": "Are you sure want to delete this Remote Browser for all monitors?", "deleteRemoteBrowserMessage": "Are you sure want to delete this Remote Browser for all monitors?",
"GrafanaOncallUrl": "Grafana Oncall URL", "GrafanaOncallUrl": "Grafana Oncall URL",
"Browser Screenshot": "Browser Screenshot", "Browser Screenshot": "Browser Screenshot",
"What is a Remote Browser?": "What is a Remote Browser?" "What is a Remote Browser?": "What is a Remote Browser?",
"wayToGetHeiiOnCallDetails": "How to get the Trigger ID and API Keys is explained in the {documentation}",
"documentationOf": "{0} Documentation"
} }

Loading…
Cancel
Save