Add ACE-Step music generation to the studio and library.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { existsSync } from 'node:fs'
|
||||
import { sendPathWithRange } from '~/server/utils/httpRange'
|
||||
import { musicContentType } from '~/utils/music'
|
||||
|
||||
export default defineEventHandler((event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const track = getTrack(owner, id)
|
||||
assertFolderAccess(event, track.folderId)
|
||||
const path = trackAudioPath(owner, track.id, track.ext)
|
||||
if (!existsSync(path)) {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Audio file is missing' })
|
||||
}
|
||||
const ext = track.ext || 'flac'
|
||||
return sendPathWithRange(event, path, musicContentType(ext), {
|
||||
'Content-Disposition': `inline; filename="${safeDownloadName(track.name)}.${ext}"`,
|
||||
'Cache-Control': 'private, max-age=0, must-revalidate'
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user