diff --git a/src/inc/routeinc/f0cklib.mjs b/src/inc/routeinc/f0cklib.mjs index 2eac94e..216caa5 100644 --- a/src/inc/routeinc/f0cklib.mjs +++ b/src/inc/routeinc/f0cklib.mjs @@ -252,6 +252,7 @@ export default { ${hallFilter} ${userHallFilter} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``} ${newerThan ? db`and items.id > ${newerThan}` : db``} ${xdFilter} @@ -294,6 +295,7 @@ export default { ${hallFilter} ${userHallFilter} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``} ${newerThan ? db`and items.id > ${newerThan}` : db``} ${xdFilter} @@ -516,6 +518,7 @@ export default { ${!fav && user ? db`and items.username ilike ${user}` : db``} ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``} `; }; @@ -552,6 +555,7 @@ export default { items.id = ${itemid} and items.active = true ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} limit 1 `; @@ -569,7 +573,7 @@ export default { if (!actitem) { // Item not found or filtered out - check if it exists but was filtered (for OG meta tags) - if (!session && getGlobalfilter()) { + if (!session && (getGlobalfilter() || cfg.websrv.public_untagged === false)) { const unfilteredItem = await db` select id from items where id = ${itemid} and active = true limit 1 `; @@ -925,6 +929,7 @@ export default { AND items.title IS NOT NULL ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``} ORDER BY random() LIMIT 1 @@ -945,6 +950,7 @@ export default { and items.active = true ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} group by items.id order by random() limit 1 @@ -987,6 +993,7 @@ export default { ${hall ? db`and items.id in (select item_id from halls_assign ha join halls h on h.id = ha.hall_id where h.slug = ${hall})` : db``} ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``} group by items.id, tags.tag order by random() @@ -1006,6 +1013,7 @@ export default { and items.active = true ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} + ${!session && cfg.websrv.public_untagged === false ? db`and exists (select 1 from tags_assign where item_id = items.id)` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``} order by random() limit 1 diff --git a/src/index.mjs b/src/index.mjs index 90130f1..914a2b3 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -1276,6 +1276,7 @@ process.on('uncaughtException', err => { enable_danmaku: cfg.websrv.enable_danmaku !== false, enable_item_title: cfg.websrv.enable_item_title !== false, enable_global_chat: !!cfg.websrv.enable_global_chat, + enable_sidebar: cfg.websrv.enable_sidebar !== false, embed_youtube_in_comments: cfg.websrv.embed_youtube_in_comments !== false, get koepfe_json() { try { diff --git a/views/snippets/footer.html b/views/snippets/footer.html index 8382b25..6decbda 100644 --- a/views/snippets/footer.html +++ b/views/snippets/footer.html @@ -102,7 +102,7 @@ @if(session) @include(snippets/metadata-modal) @endif -@if(!private_society || session) +@if((!private_society || session) && enable_sidebar)