hidden comment overview behind login

This commit is contained in:
2026-01-27 00:05:54 +01:00
parent 8cdf4a12b8
commit 966b04dbaf

View File

@@ -80,6 +80,18 @@ export default (router, tpl) => {
const offset = (page - 1) * limit; const offset = (page - 1) * limit;
const isJson = req.url.qs?.json === 'true'; 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` const comments = await db`
SELECT c.*, i.mime, i.id as item_id SELECT c.*, i.mime, i.id as item_id
FROM comments c FROM comments c