mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 21:58:15 +01:00
add timeout :3
This commit is contained in:
parent
46f8930a42
commit
8ec085f4c7
1 changed files with 68 additions and 54 deletions
|
@ -20,30 +20,22 @@ const {
|
||||||
const { api } = require("../init/pages-api.js");
|
const { api } = require("../init/pages-api.js");
|
||||||
|
|
||||||
function init(app, config, rendertemplate) {
|
function init(app, config, rendertemplate) {
|
||||||
|
var didstart = false;
|
||||||
|
initlog("wait a few mins... pt on timeout rn");
|
||||||
|
|
||||||
|
app.get("/*", function (req, res, next) {
|
||||||
|
if (didstart) return next();
|
||||||
|
|
||||||
|
return rendertemplate(res, req, "timeout.ejs");
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
didstart = true;
|
||||||
|
|
||||||
initlog("Starting superinit");
|
initlog("Starting superinit");
|
||||||
|
|
||||||
initlog("[START] Load pages");
|
initlog("[START] Load pages");
|
||||||
|
|
||||||
/* PokeTube Update daemon - checks for updates in poketube */
|
|
||||||
(async () => {
|
|
||||||
const url = `https://poketube.fun/api/version.json`;
|
|
||||||
|
|
||||||
let f = await modules
|
|
||||||
.fetch(url)
|
|
||||||
.then((res) => res.text())
|
|
||||||
.then((json) => JSON.parse(json));
|
|
||||||
|
|
||||||
if (f.vernum == api) {
|
|
||||||
console.log("[UPDATE DAEMON] PokeTube is up to date!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f.vernum != api) {
|
|
||||||
console.warn(
|
|
||||||
"[UPDATE DAEMON] PokeTube is out of date! please re-clone the poketube repo :p "
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
if (Math.random() < 0.5) {
|
if (Math.random() < 0.5) {
|
||||||
initlog("https://poketube.fun/watch?v=lpiB2wMc49g");
|
initlog("https://poketube.fun/watch?v=lpiB2wMc49g");
|
||||||
}
|
}
|
||||||
|
@ -79,9 +71,31 @@ function init(app, config, rendertemplate) {
|
||||||
initlog("[OK] Load pages");
|
initlog("[OK] Load pages");
|
||||||
|
|
||||||
initlog("Loaded pages - initing poketube finnished :3");
|
initlog("Loaded pages - initing poketube finnished :3");
|
||||||
|
setTimeout(function () {
|
||||||
|
/* PokeTube Update daemon - checks for updates in poketube */
|
||||||
|
(async () => {
|
||||||
|
const url = `https://poketube.fun/api/version.json`;
|
||||||
|
|
||||||
|
let f = await modules
|
||||||
|
.fetch(url)
|
||||||
|
.then((res) => res.text())
|
||||||
|
.then((json) => JSON.parse(json));
|
||||||
|
|
||||||
|
if (f.vernum == api) {
|
||||||
|
console.log("[UPDATE DAEMON] PokeTube is up to date!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.vernum != api) {
|
||||||
|
console.warn(
|
||||||
|
"[UPDATE DAEMON] PokeTube is out of date! please re-clone the poketube repo :p "
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}, 125000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
initlog("[FAILED] Load pages \n" + err);
|
initlog("[FAILED] Load pages \n" + err);
|
||||||
}
|
}
|
||||||
|
}, 120000);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
Loading…
Reference in a new issue