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