mirror of
https://github.com/Lomanic/presence-button-web
synced 2024-11-22 21:47:29 +00:00
🚨🐴 Checkpoint
./server.js:933874/25
This commit is contained in:
parent
0845a22b8d
commit
28f4460d27
@ -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 }));
|
||||||
|
Loading…
Reference in New Issue
Block a user