1
0

feat: Custom schedule rules
All checks were successful
Remote Deploy / deploy (push) Successful in 4s

This commit is contained in:
2025-08-14 21:08:33 +02:00
parent 14cc49a6ab
commit 06de9919a3
5 changed files with 83 additions and 12 deletions

View File

@@ -2,11 +2,19 @@ const express = require("express");
const path = require("path");
const app = express();
const fs = require("fs/promises");
const { getCurrentInterval } = require("./scheduleRules");
const PORT = process.env.PORT || 3000;
app.get('/', (_, res) => {
res.sendFile(path.join(__dirname, "db", "current.json"));
app.get('/', async (_, res) => {
const dataStr = fs.readFile(path.join(__dirname, "db", "current.json"));
const data = JSON.parse(dataStr);
data["status"] = {
currentUpdateSchedule: getCurrentInterval(),
};
res.json(data);
});
app.get("/status", async (_, res) => {
@@ -14,9 +22,9 @@ app.get("/status", async (_, res) => {
const data = JSON.parse(dataStr);
if (data.working) {
res.json({working: true})
res.json({ working: true })
} else {
res.json({working: data.working, message: data.message})
res.json({ working: data.working, message: data.message })
}
})