diff --git a/src/index.js b/src/index.js index 50f08af..181dfb7 100644 --- a/src/index.js +++ b/src/index.js @@ -195,6 +195,22 @@ app.get('/depesche', async (req, res) => { app.get("/health", (req, res) => { res.send("ok"); }); + +app.post("/states/status", (req, res) => { + if (req.query.accesskey != config.accesskey) { + return res.status(401).json({ + "success": false, + "error": "Unauthorized" + }); + } + // Append request body to file + fs.appendFileSync(cacheFolder + "status.json", JSON.stringify(req.body) + "\n"); + + res.json({ + "success": true + }); +}); + const httpsServer = https.createServer(credentials, app); httpsServer.listen(PORT, () => {