Merge pull request 'dev' (#19) from dev into master

Reviewed-on: #19
This commit is contained in:
Flummi 2022-04-21 16:33:23 +02:00
commit a44f7c2f0c
4 changed files with 10 additions and 16 deletions

View File

@ -66,7 +66,7 @@
const scroll_treshold = 1;
if(document.querySelector("div#posts")) {
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(tts < scroll_treshold) {
document.querySelector("div#footbar").style.boxShadow = "inset 0px 4px 0px var(--accent)";

View File

@ -9,10 +9,6 @@ const auth = async (req, res, next) => {
export default (router, tpl) => {
router.group(/^\/settings/, group => {
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`
select *
from user_sessions

View File

@ -2,10 +2,4 @@
import postgres from "postgres";
import cfg from "./config.mjs";
/*export default knex({
client: 'pg',
connection: cfg.sql
});*/
//export const db = postgres(cfg.sql);
export default postgres(cfg.sql);

View File

@ -20,31 +20,31 @@ import flummpress from "flummpress";
bot: await new cuffeo(cfg.clients)
};
//console.time("loading");
console.time("loading");
const modules = {
events: (await fs.readdir("./src/inc/events")).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]) => ({
[dir]: (await Promise.all(mods.map(async mod => {
const res = await Promise.race([
(await import(`./inc/${dir}/${mod}`)).default(self),
new Promise((_, rej) => setTimeout(() => rej(false), timeout))
]);
//console.timeLog("loading", `${dir}/${mod}`);
console.timeLog("loading", `${dir}/${mod}`);
return res;
}))).flat(2)
})))).reduce((a, b) => ({...a, ...b}));
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);
});
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));
});
@ -125,4 +125,8 @@ import flummpress from "flummpress";
await router.importRoutesFromPath("src/inc/routes", tpl);
app.listen(cfg.websrv.port);
db.subscribe('*:items', (row, { command, old }) => {
console.log(command, row, old);
});
})();