This commit is contained in:
parent
fbf03bfbb4
commit
2301d15abd
|
@ -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)
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@include(snippets/header_admin)
|
||||
@include(snippets/header)
|
||||
<div id="main">
|
||||
<div class="container">
|
||||
<h1>Henlo, {{ session.user }}</h1>
|
||||
<p>Hier entsteht eine Internetpräsenz!</p>
|
||||
|
@ -7,4 +8,5 @@
|
|||
total: {{ totals.total }} | tagged: {{ totals.tagged }} | untagged: {{ totals.untagged }} | sfw: {{ totals.sfw }} | nsfw: {{ totals.nsfw }}
|
||||
@endif</p>
|
||||
</div>
|
||||
</div>
|
||||
@include(snippets/footer)
|
|
@ -1,4 +1,5 @@
|
|||
@include(snippets/header_admin)
|
||||
@include(snippets/header)
|
||||
<div id="main">
|
||||
@if(log)
|
||||
<h1>last {{ log.length }} entries:</h1>
|
||||
<div class="logwrap">
|
||||
|
@ -13,4 +14,5 @@
|
|||
})();
|
||||
</script>
|
||||
@endif
|
||||
</div>
|
||||
@include(snippets/footer)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@include(snippets/header_admin)
|
||||
@include(snippets/header)
|
||||
<div id="main">
|
||||
<table class="table" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -21,4 +22,5 @@
|
|||
@endeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@include(snippets/footer)
|
|
@ -1,4 +1,5 @@
|
|||
@include(snippets/header_admin)
|
||||
@include(snippets/header)
|
||||
<div id="main">
|
||||
<table class="table" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -27,4 +28,5 @@
|
|||
@endeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@include(snippets/footer)
|
|
@ -1,19 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en" theme="@if(typeof theme !== "undefined"){{ theme }}@endif">
|
||||
<head>
|
||||
<title>@if(typeof data !== "undefined" && data.title){{ data.title }}@elsef0ck!@endif</title>
|
||||
<link rel="icon" type="image/gif" href="/s/img/favicon.gif" />
|
||||
<link rel="stylesheet" href="/s/css/f0ck.css">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="description" content="f0ck.me is the place where internet purists gather to celebrate content of all kinds">
|
||||
@if(typeof data !== "undefined" && data.item)
|
||||
<meta property="og:site_name" content="f0ck.me" />
|
||||
<meta property="og:description"/>
|
||||
<meta name="Description"/>
|
||||
<meta property="og:image" content="{{ item.thumbnail }}" />
|
||||
@endif
|
||||
</head>
|
||||
<body>
|
||||
@include(snippets/navbar_admin)
|
||||
<div id="main">
|
|
@ -8,7 +8,9 @@
|
|||
<img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar" /><span>{{ session.user }}</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="/admin">adminpanel</a></li>
|
||||
<li><a href="/admin/log">logfile</a></li>
|
||||
<li><a href="/admin/sessions">all sessions</a></li>
|
||||
<li><a href="/admin/recover">recover</a></li>
|
||||
<li><a href="/user/{{ session.user.toLowerCase() }}/f0cks">my f0cks</a></li>
|
||||
<li><a href="/user/{{ session.user.toLowerCase() }}/favs">my favs</a></li>
|
||||
<li><a href="/settings">settings</a></li>
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<nav class="navbar navbar-expand-lg">
|
||||
<a class="navbar-brand" href="/"><span class="f0ck">F0CK</span></a>
|
||||
<div class="navigation-links">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item dropdown" id="themes">
|
||||
<a class="nav-link" href="#" content="{{ theme }}" data-toggle="dropdown">Theme</a>
|
||||
<ul class="dropdown-menu">
|
||||
@each(themes as t)
|
||||
<li><a href="/theme/{{ t }}">{{ t }}</a></li>
|
||||
@endeach
|
||||
</ul>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/sessions">
|
||||
<span class="nav-link-identifier">sessions</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/log">
|
||||
<span class="nav-link-identifier">Log</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/admin/recover">
|
||||
<span class="nav-link-identifier">Recover</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/logout">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
Loading…
Reference in New Issue
Block a user