mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 15:18:32 +08:00
Merge branch 'master' into hevans/add-heii-on-call-notification-provider
This commit is contained in:
@@ -96,11 +96,15 @@ class Monitor extends BeanModel {
|
||||
screenshot = "/screenshots/" + jwt.sign(this.id, UptimeKumaServer.getInstance().jwtSecret) + ".png";
|
||||
}
|
||||
|
||||
const path = await this.getPath();
|
||||
const pathName = path.join(" / ");
|
||||
|
||||
let data = {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
description: this.description,
|
||||
pathName: await this.getPathName(),
|
||||
path,
|
||||
pathName,
|
||||
parent: this.parent,
|
||||
childrenIDs: await Monitor.getAllChildrenIDs(this.id),
|
||||
url: this.url,
|
||||
@@ -1527,11 +1531,11 @@ class Monitor extends BeanModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Full Path-Name (Groups and Name)
|
||||
* @returns {Promise<string>} Full path name of this monitor
|
||||
* Gets the full path
|
||||
* @returns {Promise<string[]>} Full path (includes groups and the name) of the monitor
|
||||
*/
|
||||
async getPathName() {
|
||||
let path = this.name;
|
||||
async getPath() {
|
||||
const path = [ this.name ];
|
||||
|
||||
if (this.parent === null) {
|
||||
return path;
|
||||
@@ -1539,7 +1543,7 @@ class Monitor extends BeanModel {
|
||||
|
||||
let parent = await Monitor.getParent(this.id);
|
||||
while (parent !== null) {
|
||||
path = `${parent.name} / ${path}`;
|
||||
path.unshift(parent.name);
|
||||
parent = await Monitor.getParent(parent.id);
|
||||
}
|
||||
|
||||
|
@@ -54,14 +54,17 @@ class Ntfy extends NotificationProvider {
|
||||
"priority": priority,
|
||||
"title": monitorJSON.name + " " + status + " [Uptime-Kuma]",
|
||||
"tags": tags,
|
||||
"actions": [
|
||||
};
|
||||
|
||||
if (monitorJSON.url && monitorJSON.url !== "https://") {
|
||||
data.actions = [
|
||||
{
|
||||
"action": "view",
|
||||
"label": "Open " + monitorJSON.name,
|
||||
"url": monitorJSON.url,
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
if (notification.ntfyIcon) {
|
||||
data.icon = notification.ntfyIcon;
|
||||
|
@@ -40,16 +40,12 @@ router.get("/api/status-page/:slug", cache("5 minutes"), async (request, respons
|
||||
]);
|
||||
|
||||
if (!statusPage) {
|
||||
sendHttpError(response, "Status Page Not Found");
|
||||
return null;
|
||||
}
|
||||
|
||||
let statusPageData = await StatusPage.getStatusPageData(statusPage);
|
||||
|
||||
if (!statusPageData) {
|
||||
sendHttpError(response, "Not Found");
|
||||
return;
|
||||
}
|
||||
|
||||
// Response
|
||||
response.json(statusPageData);
|
||||
|
||||
|
Reference in New Issue
Block a user