|
|
|
@ -3,7 +3,6 @@ const { R } = require("redbean-node");
|
|
|
|
|
const cheerio = require("cheerio");
|
|
|
|
|
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
|
|
|
|
const jsesc = require("jsesc");
|
|
|
|
|
const Maintenance = require("./maintenance");
|
|
|
|
|
const googleAnalytics = require("../google-analytics");
|
|
|
|
|
|
|
|
|
|
class StatusPage extends BeanModel {
|
|
|
|
@ -290,21 +289,17 @@ class StatusPage extends BeanModel {
|
|
|
|
|
try {
|
|
|
|
|
const publicMaintenanceList = [];
|
|
|
|
|
|
|
|
|
|
let activeCondition = Maintenance.getActiveMaintenanceSQLCondition();
|
|
|
|
|
let maintenanceBeanList = R.convertToBeans("maintenance", await R.getAll(`
|
|
|
|
|
SELECT DISTINCT maintenance.*
|
|
|
|
|
FROM maintenance
|
|
|
|
|
JOIN maintenance_status_page
|
|
|
|
|
ON maintenance_status_page.maintenance_id = maintenance.id
|
|
|
|
|
AND maintenance_status_page.status_page_id = ?
|
|
|
|
|
LEFT JOIN maintenance_timeslot
|
|
|
|
|
ON maintenance_timeslot.maintenance_id = maintenance.id
|
|
|
|
|
WHERE ${activeCondition}
|
|
|
|
|
ORDER BY maintenance.end_date
|
|
|
|
|
`, [ statusPageId ]));
|
|
|
|
|
|
|
|
|
|
for (const bean of maintenanceBeanList) {
|
|
|
|
|
publicMaintenanceList.push(await bean.toPublicJSON());
|
|
|
|
|
let maintenanceIDList = await R.getCol(`
|
|
|
|
|
SELECT DISTINCT maintenance_id
|
|
|
|
|
FROM maintenance_status_page
|
|
|
|
|
WHERE status_page_id = ?
|
|
|
|
|
`, [ statusPageId ]);
|
|
|
|
|
|
|
|
|
|
for (const maintenanceID of maintenanceIDList) {
|
|
|
|
|
let maintenance = UptimeKumaServer.getInstance().getMaintenance(maintenanceID);
|
|
|
|
|
if (maintenance && await maintenance.isUnderMaintenance()) {
|
|
|
|
|
publicMaintenanceList.push(await maintenance.toPublicJSON());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return publicMaintenanceList;
|
|
|
|
|