Fix library thumbnails and let clips keep a display name.
Extract a poster frame when a still-thumb is missing, and show the clip name in the library with the prompt on the info icon. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -35,6 +35,7 @@ export default defineEventHandler(async (event) => {
|
||||
: Math.floor(Math.random() * 2_147_483_647)
|
||||
const length = frameLength(Number(fields.duration || 5))
|
||||
const hideThumbnail = fields.hideThumbnail === 'true'
|
||||
const clipName = (fields.name || '').trim().slice(0, 80)
|
||||
const ownerKey = libraryOwnerKey(event)
|
||||
const library = publicLibrary(event)
|
||||
const folderId = library.folders.some(folder => folder.id === fields.folderId)
|
||||
@@ -60,6 +61,7 @@ export default defineEventHandler(async (event) => {
|
||||
ownerKey,
|
||||
folderId,
|
||||
hideThumbnail,
|
||||
name: clipName,
|
||||
prompt,
|
||||
aspect: fields.aspect || 'auto',
|
||||
width,
|
||||
@@ -133,6 +135,7 @@ async function runGeneration(
|
||||
ownerKey: job.library.ownerKey,
|
||||
folderId: job.library.folderId,
|
||||
hideThumbnail: job.library.hideThumbnail,
|
||||
name: job.library.name,
|
||||
prompt: job.library.prompt,
|
||||
aspect: job.library.aspect,
|
||||
width: job.library.width,
|
||||
|
||||
@@ -10,7 +10,7 @@ export default defineEventHandler((event) => {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Video file is missing' })
|
||||
}
|
||||
setHeader(event, 'Content-Type', 'video/mp4')
|
||||
setHeader(event, 'Content-Disposition', `inline; filename="${clip.id}.mp4"`)
|
||||
setHeader(event, 'Content-Disposition', `inline; filename="${safeDownloadName(clipTitle(clip))}.mp4"`)
|
||||
setHeader(event, 'Cache-Control', 'private, max-age=3600')
|
||||
return readFileSync(path)
|
||||
})
|
||||
|
||||
@@ -4,8 +4,9 @@ export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const folderId = library.folders.find(folder => folder.unlocked)?.id
|
||||
if (folderId) await importMissingComfyVideos(owner, folderId)
|
||||
await ensureClipThumbnails(owner)
|
||||
} catch {
|
||||
return library
|
||||
return publicLibrary(event)
|
||||
}
|
||||
return publicLibrary(event)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user