mirror of
https://api.glitch.com/git/presence-button
synced 2024-12-04 19:07:29 +00:00
📚🌴 Checkpoint
./server.js:933874/1408
This commit is contained in:
parent
b4b29bedfc
commit
b84f599687
23
server.js
23
server.js
@ -49,9 +49,13 @@ app.get("/img", (req, res) => {
|
||||
res.header("Pragma", "no-cache");
|
||||
res.header("Expires", "0");
|
||||
if (fuzIsOpen && new Date() - closingTimeout < lastSeen) {
|
||||
return res.sendFile(__dirname + "/views/open.svg"); // https://www.flaticon.com/free-icon/open_1234189, maybe try https://flaticons.net/customize.php?dir=Miscellaneous&icon=Open.png without attribution
|
||||
// https://www.iconfinder.com/icons/1871431/online_open_shop_shopping_sign_icon
|
||||
// formerly https://www.flaticon.com/free-icon/open_1234189, maybe try https://flaticons.net/customize.php?dir=Miscellaneous&icon=Open.png without attribution
|
||||
return res.sendFile(__dirname + "/views/open.svg");
|
||||
}
|
||||
res.sendFile(__dirname + "/views/closed.svg"); // https://www.flaticon.com/free-icon/closed_1234190, maybe try https://flaticons.net/customize.php?dir=Miscellaneous&icon=Closed.png without attribution
|
||||
// https://www.iconfinder.com/icons/1871435/closed_online_shop_shopping_sign_icon
|
||||
// formerly https://www.flaticon.com/free-icon/closed_1234190, maybe try https://flaticons.net/customize.php?dir=Miscellaneous&icon=Closed.png without attribution
|
||||
res.sendFile(__dirname + "/views/closed.svg");
|
||||
});
|
||||
|
||||
app.get("/api", (req, res) => {
|
||||
@ -146,7 +150,7 @@ request.post(
|
||||
console.log("loop", lastClosed);
|
||||
if (
|
||||
//fuzIsOpen &&
|
||||
lastSeen < new Date() - closingTimeout &&
|
||||
lastSeen < new Date() - defaultClosingTimeout &&
|
||||
lastClosed < lastSeen
|
||||
) {
|
||||
// the Fuz is newly closed, notify on matrix and write file to survive reboot
|
||||
@ -197,6 +201,19 @@ request.post(
|
||||
}
|
||||
);
|
||||
|
||||
const formatSeconds = function () {
|
||||
var seconds = Math.floor(this),
|
||||
hours = Math.floor(seconds / 3600);
|
||||
seconds -= hours*3600;
|
||||
var minutes = Math.floor(seconds / 60);
|
||||
seconds -= minutes*60;
|
||||
|
||||
if (hours < 10) {hours = "0"+hours;}
|
||||
if (minutes < 10) {minutes = "0"+minutes;}
|
||||
if (seconds < 10) {seconds = "0"+seconds;}
|
||||
return hours+':'+minutes+':'+seconds;
|
||||
}
|
||||
|
||||
if (process.env.PROJECT_DOMAIN != "") {
|
||||
process.on("SIGTERM", function() {
|
||||
console.log("SIGTERM received, sending SOS to Resurrect...");
|
||||
|
Loading…
Reference in New Issue
Block a user