mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 05:18:56 +01:00
Refactor code :3
This commit is contained in:
parent
68caecb6f2
commit
7d2506f8a2
1 changed files with 36 additions and 32 deletions
|
@ -1,5 +1,21 @@
|
||||||
const { fetcher, core, wiki, musicInfo, modules, version, initlog } = require("../libpoketube-initsys.js");
|
const {
|
||||||
const { IsJsonString, convert, getFirstLine, capitalizeFirstLetter, turntomins, getRandomInt, getRandomArbitrary } = require("../ptutils/libpt-coreutils.js");
|
fetcher,
|
||||||
|
core,
|
||||||
|
wiki,
|
||||||
|
musicInfo,
|
||||||
|
modules,
|
||||||
|
version,
|
||||||
|
initlog,
|
||||||
|
} = require("../libpoketube-initsys.js");
|
||||||
|
const {
|
||||||
|
IsJsonString,
|
||||||
|
convert,
|
||||||
|
getFirstLine,
|
||||||
|
capitalizeFirstLetter,
|
||||||
|
turntomins,
|
||||||
|
getRandomInt,
|
||||||
|
getRandomArbitrary,
|
||||||
|
} = require("../ptutils/libpt-coreutils.js");
|
||||||
const { api } = require("../init/pages-api.js");
|
const { api } = require("../init/pages-api.js");
|
||||||
|
|
||||||
function init(app, config, rendertemplate) {
|
function init(app, config, rendertemplate) {
|
||||||
|
@ -25,36 +41,24 @@ function init(app, config, rendertemplate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
initlog("Loading video pages ");
|
const modulesToLoad = [
|
||||||
require("../init/pages-video.js")(app, config, rendertemplate);
|
{ name: "video pages", path: "../init/pages-video.js" },
|
||||||
|
{ name: "redirects/old pages", path: "../init/pages-redir.js" },
|
||||||
|
{ name: "Download and channel pages", path: "../init/pages-channel-and-download.js",},
|
||||||
|
{ name: "api pages", path: "../init/pages-api.js" },
|
||||||
|
{ name: "static pages", path: "../init/pages-static.js" },
|
||||||
|
{ name: "main pages", path: "../init/pages-404-and-main.js" },
|
||||||
|
];
|
||||||
|
|
||||||
initlog("Loaded video pages ");
|
for (const moduleInfo of modulesToLoad) {
|
||||||
initlog("Loading redirects/old pages ");
|
initlog(`Loading ${moduleInfo.name}`);
|
||||||
require("../init/pages-redir.js")(app, config, rendertemplate);
|
require(moduleInfo.path)(app, config, rendertemplate);
|
||||||
initlog("Loaded redirects/old pages ");
|
initlog(`Loaded ${moduleInfo.name}`);
|
||||||
|
}
|
||||||
initlog("Loading Download and channel pages");
|
|
||||||
require("../init/pages-channel-and-download.js")(
|
|
||||||
app,
|
|
||||||
config,
|
|
||||||
rendertemplate
|
|
||||||
);
|
|
||||||
|
|
||||||
initlog("Loaded Download and channel pages");
|
|
||||||
initlog("Loading api pages");
|
|
||||||
require("../init/pages-api.js")(app, config, rendertemplate);
|
|
||||||
initlog("Loaded api pages");
|
|
||||||
|
|
||||||
initlog("Loading static pages");
|
|
||||||
require("../init/pages-static.js")(app, config, rendertemplate);
|
|
||||||
initlog("Loaded static pages");
|
|
||||||
initlog("Loading main pages");
|
|
||||||
require("../init/pages-404-and-main.js")(app, config, rendertemplate);
|
|
||||||
initlog("Loaded main pages");
|
|
||||||
|
|
||||||
initlog("[OK] Load pages");
|
initlog("[OK] Load pages");
|
||||||
|
|
||||||
initlog("Loaded pages - initing poketube finnished :3");
|
initlog("Loaded pages - initing poketube finnished :3");
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
/* PokeTube Update daemon - checks for updates in poketube */
|
/* PokeTube Update daemon - checks for updates in poketube */
|
||||||
|
@ -80,7 +84,7 @@ function init(app, config, rendertemplate) {
|
||||||
}, 30000);
|
}, 30000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
initlog("[FAILED] Load pages \n" + err);
|
initlog("[FAILED] Load pages \n" + err);
|
||||||
console.error(err)
|
console.error(err);
|
||||||
}
|
}
|
||||||
}, 30000);
|
}, 30000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue