From 9804376d30127b3ac6949f278a6758cff7cb8fae Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Thu, 28 May 2026 13:21:18 +0200 Subject: [PATCH] gfds --- public/s/js/f0ckm.js | 6 ++++-- src/inc/routes/index.mjs | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/s/js/f0ckm.js b/public/s/js/f0ckm.js index 9b45a3d..5638a78 100644 --- a/public/s/js/f0ckm.js +++ b/public/s/js/f0ckm.js @@ -552,11 +552,13 @@ window.cancelAnimFrame = (function () { if (isAllBtn) { // ALL: clear ratings cookie, set mode=3 on server + // Must set activeMode BEFORE syncRatingButtonUI so the ALL button + // active-state check (activeRatings.length === 0 && window.activeMode === 3) passes. clearRatingsCookie(); - syncRatingButtonUI(); - if (fromFilterModal) window._keepFilterModal = true; window.activeMode = 3; document.cookie = `mode=3; Path=/; Max-Age=31536000`; + syncRatingButtonUI(); + if (fromFilterModal) window._keepFilterModal = true; document.dispatchEvent(new CustomEvent('f0ck:modeChanged', { detail: { mode: 3 } })); fetch('/mode/3', { headers: { 'X-Requested-With': 'XMLHttpRequest' }, credentials: 'include' }) .then(r => r.json()) diff --git a/src/inc/routes/index.mjs b/src/inc/routes/index.mjs index d108443..e066f01 100644 --- a/src/inc/routes/index.mjs +++ b/src/inc/routes/index.mjs @@ -63,7 +63,9 @@ export default (router, tpl) => { try { const isRandom = req.cookies.random_mode === '1'; const ratingsRaw = req.cookies.ratings; - const ratingsArr = ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null; + // In All mode (mode=3), ignore the ratings cookie — it would otherwise + // filter out e.g. NSFW uploads even though the user is in "All" mode. + const ratingsArr = (req.mode === 3) ? null : (ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null); f0cks = await f0cklib.getf0cks({ user: user, mode: req.mode, @@ -87,7 +89,9 @@ export default (router, tpl) => { try { const isRandom = req.cookies.random_mode === '1'; const ratingsRaw = req.cookies.ratings; - const ratingsArr = ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null; + // In All mode (mode=3), ignore the ratings cookie — a stale ratings cookie + // (e.g. only 'sfw') would cause NSFW favorites to show 0 on the profile. + const ratingsArr = (req.mode === 3) ? null : (ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null); favs = await f0cklib.getf0cks({ user: user, mode: req.mode,