This commit is contained in:
parent
6852ac40d1
commit
38c4abae3c
26
src/inc/routes/picdump.mjs
Normal file
26
src/inc/routes/picdump.mjs
Normal 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;
|
||||
};
|
@ -15,4 +15,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@include(snippets/footer)
|
||||
@include(snippets/footer)
|
||||
|
22
views/picdump.html
Normal file
22
views/picdump.html
Normal 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)
|
@ -1,7 +1,7 @@
|
||||
@include(snippets/header)
|
||||
<div id="main">
|
||||
<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>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
@ -10,8 +10,8 @@
|
||||
<td>{{ session.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>level</td>
|
||||
<td>{{ session.level }}/100</td>
|
||||
<td>admin</td>
|
||||
<td>{{ !!session.admin }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>username</td>
|
||||
@ -19,7 +19,14 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user