Compare commits
3 Commits
39fb6eaab3
...
a44f7c2f0c
Author | SHA1 | Date | |
---|---|---|---|
a44f7c2f0c | |||
|
11f3cd9277 | ||
|
3d6757fcce |
|
@ -66,7 +66,7 @@
|
||||||
const scroll_treshold = 1;
|
const scroll_treshold = 1;
|
||||||
if(document.querySelector("div#posts")) {
|
if(document.querySelector("div#posts")) {
|
||||||
document.addEventListener("wheel", e => {
|
document.addEventListener("wheel", e => {
|
||||||
if((window.innerHeight + window.scrollY) >= document.body.offsetHeight && e.deltaY > 0) { // down
|
if(Math.ceil(window.innerHeight + window.scrollY) >= document.body.offsetHeight && e.deltaY > 0) { // down
|
||||||
if(elem = document.querySelector(".pagination > .next:not(.disabled)")) {
|
if(elem = document.querySelector(".pagination > .next:not(.disabled)")) {
|
||||||
if(tts < scroll_treshold) {
|
if(tts < scroll_treshold) {
|
||||||
document.querySelector("div#footbar").style.boxShadow = "inset 0px 4px 0px var(--accent)";
|
document.querySelector("div#footbar").style.boxShadow = "inset 0px 4px 0px var(--accent)";
|
||||||
|
|
|
@ -9,10 +9,6 @@ const auth = async (req, res, next) => {
|
||||||
export default (router, tpl) => {
|
export default (router, tpl) => {
|
||||||
router.group(/^\/settings/, group => {
|
router.group(/^\/settings/, group => {
|
||||||
group.get(/$/, auth, async (req, res) => {
|
group.get(/$/, auth, async (req, res) => {
|
||||||
/*const sessions = await sql("user_sessions")
|
|
||||||
.where("user_id", req.session.id)
|
|
||||||
.orderBy("last_used", "desc");*/
|
|
||||||
|
|
||||||
const sessions = await db`
|
const sessions = await db`
|
||||||
select *
|
select *
|
||||||
from user_sessions
|
from user_sessions
|
||||||
|
|
|
@ -2,10 +2,4 @@
|
||||||
import postgres from "postgres";
|
import postgres from "postgres";
|
||||||
import cfg from "./config.mjs";
|
import cfg from "./config.mjs";
|
||||||
|
|
||||||
/*export default knex({
|
|
||||||
client: 'pg',
|
|
||||||
connection: cfg.sql
|
|
||||||
});*/
|
|
||||||
|
|
||||||
//export const db = postgres(cfg.sql);
|
|
||||||
export default postgres(cfg.sql);
|
export default postgres(cfg.sql);
|
||||||
|
|
|
@ -20,31 +20,31 @@ import flummpress from "flummpress";
|
||||||
bot: await new cuffeo(cfg.clients)
|
bot: await new cuffeo(cfg.clients)
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.time("loading");
|
console.time("loading");
|
||||||
const modules = {
|
const modules = {
|
||||||
events: (await fs.readdir("./src/inc/events")).filter(f => f.endsWith(".mjs")),
|
events: (await fs.readdir("./src/inc/events")).filter(f => f.endsWith(".mjs")),
|
||||||
trigger: (await fs.readdir("./src/inc/trigger")).filter(f => f.endsWith(".mjs"))
|
trigger: (await fs.readdir("./src/inc/trigger")).filter(f => f.endsWith(".mjs"))
|
||||||
};
|
};
|
||||||
|
|
||||||
//console.timeLog("loading", "directories");
|
console.timeLog("loading", "directories");
|
||||||
const blah = (await Promise.all(Object.entries(modules).map(async ([dir, mods]) => ({
|
const blah = (await Promise.all(Object.entries(modules).map(async ([dir, mods]) => ({
|
||||||
[dir]: (await Promise.all(mods.map(async mod => {
|
[dir]: (await Promise.all(mods.map(async mod => {
|
||||||
const res = await Promise.race([
|
const res = await Promise.race([
|
||||||
(await import(`./inc/${dir}/${mod}`)).default(self),
|
(await import(`./inc/${dir}/${mod}`)).default(self),
|
||||||
new Promise((_, rej) => setTimeout(() => rej(false), timeout))
|
new Promise((_, rej) => setTimeout(() => rej(false), timeout))
|
||||||
]);
|
]);
|
||||||
//console.timeLog("loading", `${dir}/${mod}`);
|
console.timeLog("loading", `${dir}/${mod}`);
|
||||||
return res;
|
return res;
|
||||||
}))).flat(2)
|
}))).flat(2)
|
||||||
})))).reduce((a, b) => ({...a, ...b}));
|
})))).reduce((a, b) => ({...a, ...b}));
|
||||||
|
|
||||||
blah.events.forEach(event => {
|
blah.events.forEach(event => {
|
||||||
//console.timeLog("loading", `registering event > ${event.name}`);
|
console.timeLog("loading", `registering event > ${event.name}`);
|
||||||
self.bot.on(event.listener, event.f);
|
self.bot.on(event.listener, event.f);
|
||||||
});
|
});
|
||||||
|
|
||||||
blah.trigger.forEach(trigger => {
|
blah.trigger.forEach(trigger => {
|
||||||
//console.timeLog("loading", `registering trigger > ${trigger.name}`);
|
console.timeLog("loading", `registering trigger > ${trigger.name}`);
|
||||||
self._trigger.set(trigger.name, new self.trigger(trigger));
|
self._trigger.set(trigger.name, new self.trigger(trigger));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -125,4 +125,8 @@ import flummpress from "flummpress";
|
||||||
await router.importRoutesFromPath("src/inc/routes", tpl);
|
await router.importRoutesFromPath("src/inc/routes", tpl);
|
||||||
|
|
||||||
app.listen(cfg.websrv.port);
|
app.listen(cfg.websrv.port);
|
||||||
|
|
||||||
|
db.subscribe('*:items', (row, { command, old }) => {
|
||||||
|
console.log(command, row, old);
|
||||||
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user