9
0
mirror of https://github.com/Lomanic/presence-button-web synced 2024-11-23 05:57:30 +00:00

🚨🐴 Checkpoint

./server.js:933874/25
This commit is contained in:
Glitch (hello-express) 2019-11-03 12:08:59 +00:00
parent 0845a22b8d
commit 28f4460d27

View File

@ -30,7 +30,7 @@ app.get("/img", (req, res) => {
} }
}); });
app.get("/api", (req, res) => { app.get("/api", (req, res) => {
res.send(fuzIsOpen && Date() - 5 * 1000 < lastSeen) res.send(fuzIsOpen && new Date().getTime() - 5 * 1000 < lastSeen.getTime())
}); });
// http://expressjs.com/en/starter/basic-routing.html // http://expressjs.com/en/starter/basic-routing.html
@ -38,7 +38,7 @@ app.get("/status", (req, res) => {
if (req.query.password !== process.env.PASSWORD) { if (req.query.password !== process.env.PASSWORD) {
return res.sendStatus(401); return res.sendStatus(401);
} }
fuzIsOpen = req.query.fuzisopen === "1"; fuzIsOpen = req.query.fuzisopen == "1";
lastSeen = Date(); lastSeen = Date();
try { try {
fs.writeFileSync(db, JSON.stringify({ fuzIsOpen, lastSeen })); fs.writeFileSync(db, JSON.stringify({ fuzIsOpen, lastSeen }));