another possible fix for fav randoming
This commit is contained in:
@@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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] : []
|
||||||
|
|||||||
Reference in New Issue
Block a user