From 38c4abae3c7a76df225783a5840041ba3bbe9c4c Mon Sep 17 00:00:00 2001 From: Flummi Date: Fri, 28 Jun 2024 18:33:12 +0200 Subject: [PATCH] blah. --- src/inc/routes/picdump.mjs | 26 ++++++++++++++++++++++++++ views/index.html | 2 +- views/picdump.html | 22 ++++++++++++++++++++++ views/settings.html | 15 +++++++++++---- 4 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 src/inc/routes/picdump.mjs create mode 100644 views/picdump.html diff --git a/src/inc/routes/picdump.mjs b/src/inc/routes/picdump.mjs new file mode 100644 index 0000000..d37036f --- /dev/null +++ b/src/inc/routes/picdump.mjs @@ -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; +}; diff --git a/views/index.html b/views/index.html index bca3943..684016b 100644 --- a/views/index.html +++ b/views/index.html @@ -15,4 +15,4 @@ -@include(snippets/footer) \ No newline at end of file +@include(snippets/footer) diff --git a/views/picdump.html b/views/picdump.html new file mode 100644 index 0000000..d00bc22 --- /dev/null +++ b/views/picdump.html @@ -0,0 +1,22 @@ +@include(snippets/header) +
+

Picdump (last week)

+
+ @each(dump as line) + + @endeach +
+
+ +@include(snippets/footer) diff --git a/views/settings.html b/views/settings.html index e3da9ef..e402e73 100644 --- a/views/settings.html +++ b/views/settings.html @@ -1,7 +1,7 @@ @include(snippets/header)

Settings

- @if(session.avatar)@endif + @if(session.avatar)@endif

Account

@@ -10,8 +10,8 @@ - - + + @@ -19,7 +19,14 @@ - + + + + + + + +
{{ session.id }}
level{{ session.level }}/100admin{{ !!session.admin }}
username
avatar
mail