alotta good shit

This commit is contained in:
2026-09-19 06:20:37 +02:00
parent 74f7884525
commit 1477d56658
45 changed files with 4363 additions and 2069 deletions
+25 -2
View File
@@ -580,9 +580,32 @@ export default (router, tpl) => {
it.is_onara_active = false;
}
}
// If not in first page of feed, unshift it so thumbnail is present in background
// If not in first page of feed, add it so thumbnail is present in background
if (!foundInGrid && data.item) {
gridData.items.unshift({ ...data.item, is_onara_active: true });
const nsflId = parseInt(cfg.nsfl_tag_id, 10) || 3;
const tagId = data.item.tag_id || (data.item.is_nsfl ? nsflId : (data.item.is_nsfw ? 2 : (data.item.is_sfw ? 1 : null)));
const thumbUrl = data.item.thumb || data.item.thumbnail || (data.item.id ? `/t/${data.item.id}.webp` : null);
const cleanDest = data.item.dest ? String(data.item.dest).replace(/^\/b\//, '') : '';
const gridItem = {
...data.item,
id: data.item.id,
slug: data.item.slug,
tag_id: tagId,
thumb: thumbUrl,
dest: cleanDest,
display_name: data.item.author_display_name || data.item.display_name || data.item.username,
username: data.item.username,
mime: data.item.matching_sub_mime || data.item.mime,
thumb_size: data.item.thumb_size || 1,
is_onara_active: true
};
if (isRandom && gridData.items.length > 0) {
const insertIdx = Math.floor(Math.random() * (gridData.items.length + 1));
gridData.items.splice(insertIdx, 0, gridItem);
} else {
gridData.items.unshift(gridItem);
}
}
}