mirror of
https://api.glitch.com/git/presence-button
synced 2024-11-05 10:57:30 +00:00
🍗👜 Checkpoint
./server.js:933874/807
This commit is contained in:
parent
c8ab1a6c26
commit
b98583d32d
@ -1,5 +1,7 @@
|
|||||||
var fuzIsOpen = false;
|
var fuzIsOpen = false;
|
||||||
var lastSeen = new Date("1970-01-01");
|
var lastSeen = new Date("1970-01-01");
|
||||||
|
var lastNofified = new Date("1970-01-01");
|
||||||
|
var lastClosed = new Date("1970-01-01");
|
||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const db = "./.data/data.json";
|
const db = "./.data/data.json";
|
||||||
@ -8,6 +10,8 @@ try {
|
|||||||
var content = fs.readFileSync(db, "utf8");
|
var content = fs.readFileSync(db, "utf8");
|
||||||
fuzIsOpen = JSON.parse(content)["fuzIsOpen"];
|
fuzIsOpen = JSON.parse(content)["fuzIsOpen"];
|
||||||
lastSeen = new Date(JSON.parse(content)["lastSeen"]);
|
lastSeen = new Date(JSON.parse(content)["lastSeen"]);
|
||||||
|
lastNofified = new Date(JSON.parse(content)["lastNofified"]);
|
||||||
|
lastClosed = new Date(JSON.parse(content)["lastClosed"]);
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
|
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
@ -70,7 +74,9 @@ const listener = app.listen(process.env.PORT, function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (!fuzIsOpen || lastSeen < new Date() - 2 * 60 * 1000) {
|
||||||
|
|
||||||
|
}
|
||||||
}, 10 * 1000)
|
}, 10 * 1000)
|
||||||
|
|
||||||
if (process.env.PROJECT_DOMAIN != "") {
|
if (process.env.PROJECT_DOMAIN != "") {
|
||||||
|
Loading…
Reference in New Issue
Block a user