cleaned up
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 37s

This commit is contained in:
Flummi
2023-05-03 05:13:48 +02:00
parent fbf03bfbb4
commit 2301d15abd
8 changed files with 147 additions and 176 deletions

View File

@ -16,8 +16,14 @@ const auth = async (req, res, next) => {
export default (router, tpl) => {
router.get(/^\/login(\/)?$/, async (req, res) => {
if(req.cookies.session)
return res.reply({ body: "du bist schon eingeloggt lol" });
if(req.cookies.session) {
return res.reply({
body: tpl.render('error', {
message: "you're already logged in lol",
tmp: null
}, req)
});
}
res.reply({
body: tpl.render("login", { theme: req.cookies.theme ?? "f0ck" })
});
@ -100,7 +106,11 @@ export default (router, tpl) => {
router.get(/^\/admin(\/)?$/, auth, async (req, res) => { // frontpage
res.reply({
body: tpl.render("admin", { totals: await lib.countf0cks(), session: req.session }, req)
body: tpl.render("admin", {
totals: await lib.countf0cks(),
session: req.session,
tmp: null
}, req)
});
});
@ -116,7 +126,8 @@ export default (router, tpl) => {
body: tpl.render("admin/sessions", {
session: req.session,
sessions: rows,
totals: await lib.countf0cks()
totals: await lib.countf0cks(),
tmp: null
}, req)
});
});
@ -125,7 +136,8 @@ export default (router, tpl) => {
exec("journalctl -qeu f0ck --no-pager", (err, stdout) => {
res.reply({
body: tpl.render("admin/log", {
log: stdout.split("\n").slice(0, -1)
log: stdout.split("\n").slice(0, -1),
tmp: null
}, req)
});
});
@ -182,7 +194,8 @@ export default (router, tpl) => {
res.reply({
body: tpl.render('admin/recover', {
posts
posts,
tmp: null
}, req)
});
});