Let clips move between folders, save busy jobs, and fail dropped Comfy runs.
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>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const body = await readBody<{ folderId?: string }>(event).catch(() => ({} as { folderId?: string }))
|
||||
const folderId = String(body?.folderId || '')
|
||||
if (!folderId) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Choose a library folder' })
|
||||
}
|
||||
const clip = getClip(owner, id)
|
||||
assertFolderAccess(event, clip.folderId)
|
||||
assertFolderExists(event, folderId)
|
||||
await moveClip(owner, id, folderId)
|
||||
return publicLibrary(event)
|
||||
})
|
||||
@@ -5,9 +5,6 @@ export default defineEventHandler((event) => {
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const clip = getClip(owner, id)
|
||||
assertFolderAccess(event, clip.folderId)
|
||||
if (clip.hideThumbnail) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Thumbnail hidden' })
|
||||
}
|
||||
const path = clipThumbPath(owner, clip.id)
|
||||
if (!existsSync(path)) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Thumbnail not found' })
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
await deleteRetryDraft(owner, id)
|
||||
return publicLibrary(event)
|
||||
})
|
||||
@@ -0,0 +1,19 @@
|
||||
import { existsSync, readFileSync } from 'node:fs'
|
||||
|
||||
export default defineEventHandler((event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const draft = getRetryDraft(owner, id)
|
||||
if (!draft.stillId) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Held job has no still' })
|
||||
}
|
||||
const still = getStill(owner, draft.stillId)
|
||||
const path = stillPath(owner, still.id)
|
||||
if (!existsSync(path)) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Image file is missing' })
|
||||
}
|
||||
const buf = readFileSync(path)
|
||||
setHeader(event, 'Content-Type', imageContentType(buf))
|
||||
setHeader(event, 'Cache-Control', 'private, max-age=3600')
|
||||
return buf
|
||||
})
|
||||
@@ -30,7 +30,8 @@ export default defineEventHandler(async (event) => {
|
||||
filename: image.filename,
|
||||
data: image.data,
|
||||
width: Number(fields.width || 0),
|
||||
height: Number(fields.height || 0)
|
||||
height: Number(fields.height || 0),
|
||||
hideInput: fields.hideInput === 'true'
|
||||
})
|
||||
return { still, ...publicLibrary(event) }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user