another possible fix for fav randoming

This commit is contained in:
x
2026-01-23 22:06:57 +01:00
parent 03f2630090
commit 0a5f57b5a9
2 changed files with 5 additions and 1 deletions

View File

@@ -381,7 +381,7 @@ window.requestAnimFrame = (function () {
const wUserMatch = window.location.href.match(/\/user\/([^/]+)/); const wUserMatch = window.location.href.match(/\/user\/([^/]+)/);
if (wUserMatch) { if (wUserMatch) {
params.append('user', decodeURIComponent(wUserMatch[1])); params.append('user', decodeURIComponent(wUserMatch[1]));
if (window.location.href.includes('/favs/')) { if (window.location.href.match(/\/favs(\/|$|\?)/)) {
params.append('fav', 'true'); params.append('fav', 'true');
} }
} }

View File

@@ -25,6 +25,8 @@ export default router => {
const hasSession = !!req.session; const hasSession = !!req.session;
const modequery = mime.startsWith("audio") ? lib.getMode(0) : lib.getMode(req.session?.mode ?? 0); const modequery = mime.startsWith("audio") ? lib.getMode(0) : lib.getMode(req.session?.mode ?? 0);
console.log('[RANDOM DEBUG] hasSession:', hasSession, 'globalfilter:', globalfilter, 'modequery:', modequery, 'isFav:', isFav);
const rows = await db` const rows = await db`
select "items".* select "items".*
from "items" from "items"
@@ -45,6 +47,8 @@ export default router => {
limit 1 limit 1
`; `;
console.log('[RANDOM DEBUG] Result item id:', rows[0]?.id);
return res.json({ return res.json({
success: rows.length > 0, success: rows.length > 0,
items: rows.length > 0 ? rows[0] : [] items: rows.length > 0 ? rows[0] : []