This commit is contained in:
x
2025-04-21 14:48:40 +02:00
parent a3b66567c9
commit e18270a1ce
6 changed files with 31 additions and 26 deletions

View File

@ -4,20 +4,22 @@ import lib from "../../inc/lib.mjs";
import f0cklib from "../routeinc/f0cklib.mjs";
export default (router, tpl) => {
router.get(/^\/tags$/,lib.loggedin, async (req, res) => {
router.get(/^\/tags$/, async (req, res) => {
const phrase = cfg.websrv.phrases[~~(Math.random() * cfg.websrv.phrases.length)];
const nsfp = cfg.nsfp.map(n => `${n}`);
const toptags = await db`
SELECT t.id, t.tag, COUNT(DISTINCT ta.item_id) AS total_items
FROM tags t
LEFT JOIN tags_assign ta ON t.id = ta.tag_id
WHERE t.id not in (${db.unsafe(nsfp)})
GROUP BY t.id, t.tag
ORDER BY total_items DESC
LIMIT 500
;
`;
res.reply({
body: tpl.render('tags', {
toptags,

View File

@ -110,7 +110,7 @@ process.on('unhandledRejection', err => {
db({
user_id: +user[0].id,
mode: user[0].mode ?? 0,
theme: req.session.theme ?? 'f0ck',
theme: req.session.theme ?? 'atmos',
fullscreen: req.session.fullscreen || 0
}, 'user_id', 'mode', 'theme', 'fullscreen')
}