From 6933c9b3834874bcf1ed4e30910cc5dffeff5d89 Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Sun, 3 Nov 2019 14:37:00 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=87=F0=9F=91=80=20Checkpoint=20./serve?= =?UTF-8?q?r.js:933874/3654?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server.js b/server.js index 0e2f9e3..b80abb1 100644 --- a/server.js +++ b/server.js @@ -10,7 +10,6 @@ try { lastSeen = new Date(JSON.parse(content)["lastSeen"]); } catch (err) {} -console.log(JSON.stringify({ fuzIsOpen, lastSeen })); const express = require("express"); const app = express(); @@ -25,13 +24,11 @@ app.get("/", (req, res) => { // http://expressjs.com/en/starter/basic-routing.html app.get("/img", (req, res) => { res.sendFile(__dirname + "/views/index.html"); - if (fuzIsOpen && Date() - 5 * 60 * 1000 < lastSeen) { - + if (fuzIsOpen && Date() - 2 * 60 * 1000 < lastSeen) { } }); app.get("/api", (req, res) => { - console.log(fuzIsOpen, new Date() - 5 * 1000 < lastSeen) - res.send(fuzIsOpen && new Date() - 5 * 1000 < lastSeen) + res.send(fuzIsOpen && new Date() - 2 * 60 * 1000 < lastSeen); }); // http://expressjs.com/en/starter/basic-routing.html @@ -40,7 +37,7 @@ app.get("/status", (req, res) => { return res.sendStatus(401); } fuzIsOpen = req.query.fuzisopen == "1"; - lastSeen = Date(); + lastSeen = new Date(); try { fs.writeFileSync(db, JSON.stringify({ fuzIsOpen, lastSeen })); } catch (err) {}