import sql from "../../inc/sql.mjs"; const auth = async (req, res, next) => { if(!req.session) return res.redirect("/login"); return 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"); res.reply({ body: tpl.render('settings', { tmp: null, sessions }, req) }); }); }); return router; };