From d91c2cc4a74ffdbfc91e2c3df340d60970f3399d Mon Sep 17 00:00:00 2001 From: "Glitch (hello-express)" Date: Mon, 4 Nov 2019 23:42:52 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8D=A9=F0=9F=91=A9=20Checkpoint=20./serve?= =?UTF-8?q?r.js:933874/59?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 34c72c8..406baae 100644 --- a/server.js +++ b/server.js @@ -26,7 +26,7 @@ app.get("/", (req, res) => { }); app.get("/img", (req, res) => { - if (fuzIsOpen && new Date() - 2 * 60 * 1000 < lastSeen) { + if (fuzIsOpen && new Date() - closingTimeout < lastSeen) { return res.sendFile(__dirname + "/views/open.svg"); // https://www.flaticon.com/free-icon/open_1234189 } res.sendFile(__dirname + "/views/closed.svg"); // https://www.flaticon.com/free-icon/closed_1234190 @@ -108,7 +108,7 @@ request.post( const accessToken = JSON.parse(body)["access_token"]; const loop = () => { console.log("loop", lastClosed); - if (lastSeen < new Date() - 2 * 60 * 1000 && lastClosed < lastSeen) { + if (lastSeen < new Date() - closingTimeout && lastClosed < lastSeen) { // the Fuz is newly closed, notify on matrix and write file to survive reboot lastClosed = new Date(); //lastNofified = new Date(); @@ -152,7 +152,7 @@ request.post( setTimeout(loop, 10 * 1000); } }; - setTimeout(loop, 1 * 1000); // give some time for presence button to show up (1 min) + setTimeout(loop, 1 * 60 * 1000); // give some time for presence button to show up (1 min) } );