previews and make sure blurry thumb gets always generated when rating is changed later on

This commit is contained in:
2026-05-23 15:35:42 +02:00
parent 97cc69b337
commit 3e6298f81c
2 changed files with 39 additions and 0 deletions

View File

@@ -115,6 +115,16 @@ export default router => {
await db`INSERT INTO tags_assign ${db({ tag_id: nextTagId, item_id: postid, user_id: +req.session.id })}`;
}
// Automatically generate blurred thumbnail if cycling TO NSFW or NSFL
if (nextTagId === 2 || nextTagId === nsflId) {
const blurPath = path.join(cfg.paths.t, `${postid}_blur.webp`);
try {
await fs.promises.access(blurPath);
} catch {
await queue.genBlurredThumbnail(postid, false);
}
}
const labels = { 1: { label: 'SFW', cls: 'sfw' }, 2: { label: 'NSFW', cls: 'nsfw' }, [nsflId]: { label: 'NSFL', cls: 'nsfl' } };
const { label, cls } = labels[nextTagId];