Held jobs restore the form after a 3-minute wait, hidden stills stay blurred in the picker, and reloading Comfy no longer leaves xaigen spinning. Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
602 B
TypeScript
17 lines
602 B
TypeScript
import { existsSync, readFileSync } from 'node:fs'
|
|
|
|
export default defineEventHandler((event) => {
|
|
const { owner } = assertLibraryOwner(event)
|
|
const id = String(getRouterParam(event, 'id') || '')
|
|
const clip = getClip(owner, id)
|
|
assertFolderAccess(event, clip.folderId)
|
|
const path = clipThumbPath(owner, clip.id)
|
|
if (!existsSync(path)) {
|
|
throw createError({ statusCode: 404, statusMessage: 'Thumbnail not found' })
|
|
}
|
|
const buf = readFileSync(path)
|
|
setHeader(event, 'Content-Type', imageContentType(buf))
|
|
setHeader(event, 'Cache-Control', 'private, max-age=3600')
|
|
return buf
|
|
})
|