From 966b04dbaf0d11a1237927db864efb40d3a98fe9 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Tue, 27 Jan 2026 00:05:54 +0100 Subject: [PATCH] hidden comment overview behind login --- src/inc/routes/comments.mjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/inc/routes/comments.mjs b/src/inc/routes/comments.mjs index 193a13c..6a1d837 100644 --- a/src/inc/routes/comments.mjs +++ b/src/inc/routes/comments.mjs @@ -80,6 +80,18 @@ export default (router, tpl) => { const offset = (page - 1) * limit; const isJson = req.url.qs?.json === 'true'; + // Require login + if (!req.session || !req.session.user) { + if (isJson) { + return res.reply({ + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ success: false, require_login: true }) + }); + } else { + return res.redirect('/login'); + } + } + const comments = await db` SELECT c.*, i.mime, i.id as item_id FROM comments c