Compare commits

..

No commits in common. "a44f7c2f0ce7249e7737eb733c2d483b007d4fc8" and "39fb6eaab327804a6f404600d334e7f833aacd17" have entirely different histories.

4 changed files with 16 additions and 10 deletions

View File

@ -66,7 +66,7 @@
const scroll_treshold = 1;
if(document.querySelector("div#posts")) {
document.addEventListener("wheel", e => {
if(Math.ceil(window.innerHeight + window.scrollY) >= document.body.offsetHeight && e.deltaY > 0) { // down
if((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,6 +9,10 @@ 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,4 +2,10 @@
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,8 +125,4 @@ 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);
});
})();