blah.
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 29s

This commit is contained in:
Flummi 2024-06-28 18:33:12 +02:00
parent 6852ac40d1
commit 38c4abae3c
4 changed files with 60 additions and 5 deletions

View File

@ -0,0 +1,26 @@
import db from "../../inc/sql.mjs";
import cfg from "../../inc/config.mjs";
import f0cklib from "../routeinc/f0cklib.mjs";
export default (router, tpl) => {
router.get(/^\/picdump$/, async (req, res) => {
const dump = await db`
SELECT *
FROM items
WHERE (
to_timestamp(stamp) >= date_trunc('week', CURRENT_TIMESTAMP - interval '1 week') AND
to_timestamp(stamp) < date_trunc('week', CURRENT_TIMESTAMP)
) AND
mime LIKE 'image/%'
ORDER BY stamp DESC
`;
res.reply({
body: tpl.render('picdump', {
dump,
tmp: null
}, req)
});
});
return router;
};

22
views/picdump.html Normal file
View File

@ -0,0 +1,22 @@
@include(snippets/header)
<div id="main">
<h2>Picdump (last week)</h2>
<div class="picdump">
@each(dump as line)
<a href="/{{ line.id }}"><img src="/t/{{ line.id }}.webp"></a>
@endeach
</div>
</div>
<style>
.picdump {
width: 100%;
padding: 10px;
}
.picdump > a {
margin-top: 12px;
}
.picdump > a > img {
width: 100%;
}
</style>
@include(snippets/footer)

View File

@ -1,7 +1,7 @@
@include(snippets/header) @include(snippets/header)
<div id="main"> <div id="main">
<h1>Settings</h1> <h1>Settings</h1>
@if(session.avatar)<a href="/{{ session.avatar }}"><img id="img_avatar" src="/t/{{ session.avatar }}.webp" /></a>@endif @if(session.avatar)<a href="/{{ session.avatar }}"><img id="img_avatar" src="/t/{{ session.avatar }}.webp"></a>@endif
<h2>Account</h2> <h2>Account</h2>
<table class="table"> <table class="table">
<tbody> <tbody>
@ -10,8 +10,8 @@
<td>{{ session.id }}</td> <td>{{ session.id }}</td>
</tr> </tr>
<tr> <tr>
<td>level</td> <td>admin</td>
<td>{{ session.level }}/100</td> <td>{{ !!session.admin }}</td>
</tr> </tr>
<tr> <tr>
<td>username</td> <td>username</td>
@ -19,7 +19,14 @@
</tr> </tr>
<tr> <tr>
<td>avatar</td> <td>avatar</td>
<td><input type="text" class="input" name="i_avatar" value="{{ session.avatar }}" /><input type="submit" id="s_avatar" value="save" /></td> <td><input type="text" class="input" name="i_avatar" value="{{ session.avatar }}"></td>
</tr>
<tr>
<td>mail</td>
<td><input type="text" class="input" name="i_mail" placeholder="hashed" disabled></td>
</tr>
<tr>
<td colspan="2"><input type="submit" id="s_avatar" value="save"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>