From c9f5dc02fab9f6adc29ca930331d2f670b1fbb6a Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Fri, 7 Aug 2026 22:14:23 +0200 Subject: [PATCH] hgdf --- src/inc/routeinc/f0cklib.mjs | 7 +++++++ src/inc/routes/scroller.mjs | 2 ++ src/inc/trigger/f0ckrand.mjs | 6 +++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/inc/routeinc/f0cklib.mjs b/src/inc/routeinc/f0cklib.mjs index 8ebccd8..dca6c54 100644 --- a/src/inc/routeinc/f0cklib.mjs +++ b/src/inc/routeinc/f0cklib.mjs @@ -755,6 +755,7 @@ export default { } WHERE ${useTagIdOpt ? db`ta.tag_id = ${tagId}` : db`${db.unsafe(modequery)}`} AND items.active = true + AND coalesce(items.visibility, 0) = 0 ${mimeSQL} ${checkFilter ? db`AND filter_ta.tag_id IS NULL` : db``} ${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = ta.item_id and tag_id = any(${excludedTags}::int[]))` : db``} @@ -1045,6 +1046,7 @@ export default { WHERE ${db.unsafe(modequery)} AND items.active = true + AND coalesce(items.visibility, 0) = 0 AND items.title ILIKE ${'%' + titleQuery + '%'} AND items.title IS NOT NULL ${mimeSQL} @@ -1067,6 +1069,7 @@ export default { ${db.unsafe(modequery)} and "user".user ilike ${user} and items.active = true + and coalesce(items.visibility, 0) = 0 ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``} group by items.id @@ -1106,6 +1109,7 @@ export default { where ${db.unsafe(modequery)} and items.active = true + and coalesce(items.visibility, 0) = 0 ${tagFilter} ${user ? db`and items.username ilike ${user}` : db``} ${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``} @@ -1128,6 +1132,7 @@ export default { ${db.unsafe(modequery)} and h.slug = ${hall} and items.active = true + and coalesce(items.visibility, 0) = 0 ${mimeSQL} ${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : 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``} @@ -1144,6 +1149,7 @@ export default { ${db.unsafe(modequery)} and uha.hall_id = ${userHallId} and items.active = true + and coalesce(items.visibility, 0) = 0 ${mimeSQL} ${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() @@ -1170,6 +1176,7 @@ export default { ${useTagIdOpt ? db`INNER JOIN tags_assign ta ON ta.item_id = items.id AND ta.tag_id = ${tagId}` : db``} ${checkFilter ? db`LEFT JOIN tags_assign filter_ta ON filter_ta.item_id = items.id AND filter_ta.tag_id IN ${db(nsfpIds)}` : db``} WHERE items.active = true + AND coalesce(items.visibility, 0) = 0 ${mimeSQL} ${checkFilter ? db`AND filter_ta.tag_id IS NULL` : 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``} diff --git a/src/inc/routes/scroller.mjs b/src/inc/routes/scroller.mjs index 56c96fc..d66233d 100644 --- a/src/inc/routes/scroller.mjs +++ b/src/inc/routes/scroller.mjs @@ -268,6 +268,7 @@ export default (router, tpl) => { WHERE ${db.unsafe(modeQuery)} AND items.active = true + AND COALESCE(items.visibility, 0) = 0 ${excludeSwfSQL} ${excludePdfSQL} ${excludeArchiveSQL} @@ -292,6 +293,7 @@ export default (router, tpl) => { WHERE ${db.unsafe(modeQuery)} AND items.active = true + AND COALESCE(items.visibility, 0) = 0 ${excludeSwfSQL} ${excludePdfSQL} ${excludeArchiveSQL} diff --git a/src/inc/trigger/f0ckrand.mjs b/src/inc/trigger/f0ckrand.mjs index 61fce90..0b7e271 100644 --- a/src/inc/trigger/f0ckrand.mjs +++ b/src/inc/trigger/f0ckrand.mjs @@ -34,7 +34,7 @@ export default async bot => { rows = await db` select id, mime, username, size from "items" - where id >= ${randomId} and active = true + where id >= ${randomId} and active = true and coalesce(visibility, 0) = 0 order by id asc limit 1 `; @@ -43,7 +43,7 @@ export default async bot => { rows = await db` select id, mime, username, size from "items" - where active = true + where active = true and coalesce(visibility, 0) = 0 order by id asc limit 1 `; @@ -54,7 +54,7 @@ export default async bot => { rows = await db` select id, mime, username, size from "items" - where + where active = true and coalesce(visibility, 0) = 0 and ${args.map(a => a.charAt(0) === "!" ? db`username not ilike ${a.slice(1)}` : db`username ilike ${a}`