This commit is contained in:
@ -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)
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user