This commit is contained in:
parent
fbf03bfbb4
commit
2301d15abd
|
@ -16,8 +16,14 @@ const auth = async (req, res, next) => {
|
||||||
export default (router, tpl) => {
|
export default (router, tpl) => {
|
||||||
|
|
||||||
router.get(/^\/login(\/)?$/, async (req, res) => {
|
router.get(/^\/login(\/)?$/, async (req, res) => {
|
||||||
if(req.cookies.session)
|
if(req.cookies.session) {
|
||||||
return res.reply({ body: "du bist schon eingeloggt lol" });
|
return res.reply({
|
||||||
|
body: tpl.render('error', {
|
||||||
|
message: "you're already logged in lol",
|
||||||
|
tmp: null
|
||||||
|
}, req)
|
||||||
|
});
|
||||||
|
}
|
||||||
res.reply({
|
res.reply({
|
||||||
body: tpl.render("login", { theme: req.cookies.theme ?? "f0ck" })
|
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
|
router.get(/^\/admin(\/)?$/, auth, async (req, res) => { // frontpage
|
||||||
|
|
||||||
res.reply({
|
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", {
|
body: tpl.render("admin/sessions", {
|
||||||
session: req.session,
|
session: req.session,
|
||||||
sessions: rows,
|
sessions: rows,
|
||||||
totals: await lib.countf0cks()
|
totals: await lib.countf0cks(),
|
||||||
|
tmp: null
|
||||||
}, req)
|
}, req)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -125,7 +136,8 @@ export default (router, tpl) => {
|
||||||
exec("journalctl -qeu f0ck --no-pager", (err, stdout) => {
|
exec("journalctl -qeu f0ck --no-pager", (err, stdout) => {
|
||||||
res.reply({
|
res.reply({
|
||||||
body: tpl.render("admin/log", {
|
body: tpl.render("admin/log", {
|
||||||
log: stdout.split("\n").slice(0, -1)
|
log: stdout.split("\n").slice(0, -1),
|
||||||
|
tmp: null
|
||||||
}, req)
|
}, req)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -182,7 +194,8 @@ export default (router, tpl) => {
|
||||||
|
|
||||||
res.reply({
|
res.reply({
|
||||||
body: tpl.render('admin/recover', {
|
body: tpl.render('admin/recover', {
|
||||||
posts
|
posts,
|
||||||
|
tmp: null
|
||||||
}, req)
|
}, req)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
@include(snippets/header_admin)
|
@include(snippets/header)
|
||||||
<div class="container">
|
<div id="main">
|
||||||
|
<div class="container">
|
||||||
<h1>Henlo, {{ session.user }}</h1>
|
<h1>Henlo, {{ session.user }}</h1>
|
||||||
<p>Hier entsteht eine Internetpräsenz!</p>
|
<p>Hier entsteht eine Internetpräsenz!</p>
|
||||||
<img src="/s/img/favicon.gif" alt="f0ck bash">
|
<img src="/s/img/favicon.gif" alt="f0ck bash">
|
||||||
<p>@if(typeof totals !== "undefined")
|
<p>@if(typeof totals !== "undefined")
|
||||||
total: {{ totals.total }} | tagged: {{ totals.tagged }} | untagged: {{ totals.untagged }} | sfw: {{ totals.sfw }} | nsfw: {{ totals.nsfw }}
|
total: {{ totals.total }} | tagged: {{ totals.tagged }} | untagged: {{ totals.untagged }} | sfw: {{ totals.sfw }} | nsfw: {{ totals.nsfw }}
|
||||||
@endif</p>
|
@endif</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@include(snippets/footer)
|
@include(snippets/footer)
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
@include(snippets/header_admin)
|
@include(snippets/header)
|
||||||
@if(log)
|
<div id="main">
|
||||||
<h1>last {{ log.length }} entries:</h1>
|
@if(log)
|
||||||
<div class="logwrap">
|
<h1>last {{ log.length }} entries:</h1>
|
||||||
@each(log as line)
|
<div class="logwrap">
|
||||||
<p>{{ line }}</p>
|
@each(log as line)
|
||||||
@endeach
|
<p>{{ line }}</p>
|
||||||
|
@endeach
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
(() => {
|
||||||
|
const d = document.querySelector("div.logwrap");
|
||||||
|
d.scrollTop = d.scrollHeight;
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<script>
|
|
||||||
(() => {
|
|
||||||
const d = document.querySelector("div.logwrap");
|
|
||||||
d.scrollTop = d.scrollHeight;
|
|
||||||
})();
|
|
||||||
</script>
|
|
||||||
@endif
|
|
||||||
@include(snippets/footer)
|
@include(snippets/footer)
|
||||||
|
|
|
@ -1,24 +1,26 @@
|
||||||
@include(snippets/header_admin)
|
@include(snippets/header)
|
||||||
<table class="table" style="width: 100%">
|
<div id="main">
|
||||||
<thead>
|
<table class="table" style="width: 100%">
|
||||||
<tr>
|
<thead>
|
||||||
<td></td>
|
<tr>
|
||||||
<td>ID</td>
|
<td></td>
|
||||||
<td>f0cker</td>
|
<td>ID</td>
|
||||||
<td>mime</td>
|
<td>f0cker</td>
|
||||||
<td></td>
|
<td>mime</td>
|
||||||
</tr>
|
<td></td>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
@each(posts as post)
|
<tbody>
|
||||||
<tr>
|
@each(posts as post)
|
||||||
<td><img src="data:image/webp;base64,{{ post.thumbnail }}" /></td>
|
<tr>
|
||||||
<td>{{ post.id }}</td>
|
<td><img src="data:image/webp;base64,{{ post.thumbnail }}" /></td>
|
||||||
<td>{{ post.username }}</td>
|
<td>{{ post.id }}</td>
|
||||||
<td>{{ post.mime }}</td>
|
<td>{{ post.username }}</td>
|
||||||
<td><a href="/admin/recover/?id={{ post.id }}">recover</a></td>
|
<td>{{ post.mime }}</td>
|
||||||
</tr>
|
<td><a href="/admin/recover/?id={{ post.id }}">recover</a></td>
|
||||||
@endeach
|
</tr>
|
||||||
</tbody>
|
@endeach
|
||||||
</table>
|
</tbody>
|
||||||
@include(snippets/footer)
|
</table>
|
||||||
|
</div>
|
||||||
|
@include(snippets/footer)
|
||||||
|
|
|
@ -1,30 +1,32 @@
|
||||||
@include(snippets/header_admin)
|
@include(snippets/header)
|
||||||
<table class="table" style="width: 100%">
|
<div id="main">
|
||||||
<thead>
|
<table class="table" style="width: 100%">
|
||||||
<tr>
|
<thead>
|
||||||
<td></td>
|
<tr>
|
||||||
<td>ID</td>
|
<td></td>
|
||||||
<td>userid</td>
|
<td>ID</td>
|
||||||
<td>user</td>
|
<td>userid</td>
|
||||||
<td>browser</td>
|
<td>user</td>
|
||||||
<td>created_at</td>
|
<td>browser</td>
|
||||||
<td>last_used</td>
|
<td>created_at</td>
|
||||||
<td>last_action</td>
|
<td>last_used</td>
|
||||||
</tr>
|
<td>last_action</td>
|
||||||
</thead>
|
</tr>
|
||||||
<tbody>
|
</thead>
|
||||||
@each(sessions as session)
|
<tbody>
|
||||||
<tr>
|
@each(sessions as session)
|
||||||
<td>{{ session.kmsi ? '⚓' : '' }}</td>
|
<tr>
|
||||||
<td>{{ session.id }}</td>
|
<td>{{ session.kmsi ? '⚓' : '' }}</td>
|
||||||
<td>{{ session.user_id }}</td>
|
<td>{{ session.id }}</td>
|
||||||
<td>{{ session.user }}</td>
|
<td>{{ session.user_id }}</td>
|
||||||
<td>{{ session.browser }}</td>
|
<td>{{ session.user }}</td>
|
||||||
<td>{{ new Date(session.created_at * 1e3).toLocaleString("de-DE") }}</td>
|
<td>{{ session.browser }}</td>
|
||||||
<td>{{ new Date(session.last_used * 1e3).toLocaleString("de-DE") }}</td>
|
<td>{{ new Date(session.created_at * 1e3).toLocaleString("de-DE") }}</td>
|
||||||
<td>{{ session.last_action }}</td>
|
<td>{{ new Date(session.last_used * 1e3).toLocaleString("de-DE") }}</td>
|
||||||
</tr>
|
<td>{{ session.last_action }}</td>
|
||||||
@endeach
|
</tr>
|
||||||
</tbody>
|
@endeach
|
||||||
</table>
|
</tbody>
|
||||||
@include(snippets/footer)
|
</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">
|
|
|
@ -2,53 +2,55 @@
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<a class="navbar-brand" href="/"><span class="f0ck" width="" height="">F0CK</span></a>
|
<a class="navbar-brand" href="/"><span class="f0ck" width="" height="">F0CK</span></a>
|
||||||
<div class="navigation-links">
|
<div class="navigation-links">
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link user" href="#" content="{{ session.user }}" data-toggle="dropdown">
|
<a class="nav-link user" href="#" content="{{ session.user }}" data-toggle="dropdown">
|
||||||
<img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar" /><span>{{ session.user }}</span>
|
<img src="@if(session.avatar)/t/{{ session.avatar }}.webp@else/s/img/ava/default.png@endif" class="avatar" /><span>{{ session.user }}</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><a href="/admin">adminpanel</a></li>
|
<li><a href="/admin/log">logfile</a></li>
|
||||||
<li><a href="/user/{{ session.user.toLowerCase() }}/f0cks">my f0cks</a></li>
|
<li><a href="/admin/sessions">all sessions</a></li>
|
||||||
<li><a href="/user/{{ session.user.toLowerCase() }}/favs">my favs</a></li>
|
<li><a href="/admin/recover">recover</a></li>
|
||||||
<li><a href="/settings">settings</a></li>
|
<li><a href="/user/{{ session.user.toLowerCase() }}/f0cks">my f0cks</a></li>
|
||||||
<li><a href="/search">search</a></li>
|
<li><a href="/user/{{ session.user.toLowerCase() }}/favs">my favs</a></li>
|
||||||
<li><a href="/about">About</a></li>
|
<li><a href="/settings">settings</a></li>
|
||||||
<li><a href="/ranking">Ranking</a></li>
|
<li><a href="/search">search</a></li>
|
||||||
<li><a href="/logout">logout</a></li>
|
<li><a href="/about">About</a></li>
|
||||||
</ul>
|
<li><a href="/ranking">Ranking</a></li>
|
||||||
</li>
|
<li><a href="/logout">logout</a></li>
|
||||||
<li class="nav-item dropdown" id="themes">
|
</ul>
|
||||||
<a class="nav-link ddcontent" href="#" content="{{ theme }}" data-toggle="dropdown">Themes</a>
|
</li>
|
||||||
<ul class="dropdown-menu">
|
<li class="nav-item dropdown" id="themes">
|
||||||
@each(themes as t)
|
<a class="nav-link ddcontent" href="#" content="{{ theme }}" data-toggle="dropdown">Themes</a>
|
||||||
<li><a href="/theme/{{ t }}">{{ t }}</a></li>
|
<ul class="dropdown-menu">
|
||||||
@endeach
|
@each(themes as t)
|
||||||
</ul>
|
<li><a href="/theme/{{ t }}">{{ t }}</a></li>
|
||||||
</li>
|
@endeach
|
||||||
<li class="nav-item dropdown">
|
</ul>
|
||||||
<a class="nav-link ddcontent" href="#"@if(tmp?.mime) content="{{ tmp?.mime }}" data-toggle="dropdown"@endif>Filter@if(!tmp?.mime) ▼@endif</a>
|
</li>
|
||||||
<ul class="dropdown-menu">
|
<li class="nav-item dropdown">
|
||||||
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endif">All</a></li>
|
<a class="nav-link ddcontent" href="#"@if(tmp?.mime) content="{{ tmp?.mime }}" data-toggle="dropdown"@endif>Filter@if(!tmp?.mime) ▼@endif</a>
|
||||||
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endifaudio">Audio</a></li>
|
<ul class="dropdown-menu">
|
||||||
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endifvideo">Video</a></li>
|
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endif">All</a></li>
|
||||||
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endifimage">Image</a></li>
|
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endifaudio">Audio</a></li>
|
||||||
</ul>
|
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endifvideo">Video</a></li>
|
||||||
</li>
|
<li><a class="dropdown-item" href="/@if(tmp?.user)user/{{ tmp?.user }}/@endifimage">Image</a></li>
|
||||||
<li class="nav-item @if(session)dropdown@endif">
|
</ul>
|
||||||
<a class="nav-link ddcontent" href="#"@if(typeof session.mode !== "undefined") content="{{ modes[session.mode] ?? 'sfw' }}" data-toggle="dropdown"@endif>Mode</a>
|
</li>
|
||||||
<ul class="dropdown-menu">
|
<li class="nav-item @if(session)dropdown@endif">
|
||||||
@for(let i = 0; i < modes.length; i++)
|
<a class="nav-link ddcontent" href="#"@if(typeof session.mode !== "undefined") content="{{ modes[session.mode] ?? 'sfw' }}" data-toggle="dropdown"@endif>Mode</a>
|
||||||
<li><a class="dropdown-item" href="/mode/{{ i }}">{{ modes[i] }}</a></li>
|
<ul class="dropdown-menu">
|
||||||
@endfor
|
@for(let i = 0; i < modes.length; i++)
|
||||||
</ul>
|
<li><a class="dropdown-item" href="/mode/{{ i }}">{{ modes[i] }}</a></li>
|
||||||
</li>
|
@endfor
|
||||||
<li class="nav-item">
|
</ul>
|
||||||
<a id="random" class="nav-link" href="/random">
|
</li>
|
||||||
<span class="nav-link-identifier">Random</span>
|
<li class="nav-item">
|
||||||
</a>
|
<a id="random" class="nav-link" href="/random">
|
||||||
</li>
|
<span class="nav-link-identifier">Random</span>
|
||||||
</ul>
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse show" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse show" id="navbarSupportedContent">
|
||||||
<div class="pagination-container-fluid">
|
<div class="pagination-container-fluid">
|
||||||
|
|
|
@ -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