Add paginated library JSON and dedicated still thumbs that never stream archive masters.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
import { publicLibrary, publicLibraryPage } from '~/server/utils/library'
|
||||
|
||||
export default defineEventHandler((event) => {
|
||||
const light = String(getQuery(event).light || '') === '1'
|
||||
const query = getQuery(event)
|
||||
const light = String(query.light || '') === '1'
|
||||
const limitRaw = query.limit
|
||||
const wantsPage = limitRaw != null && String(limitRaw) !== ''
|
||||
|
||||
if (wantsPage) {
|
||||
const page = publicLibraryPage(event, {
|
||||
limit: Number(limitRaw) || 50,
|
||||
cursor: String(query.cursor || ''),
|
||||
folderId: String(query.folderId || query.folder || ''),
|
||||
type: String(query.type || query.filter || 'all')
|
||||
})
|
||||
try {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const folderId = page.folders.find(folder => folder.unlocked)?.id
|
||||
void maintainLibrary(owner, folderId).catch(() => null)
|
||||
} catch { /* locked or anonymous */ }
|
||||
return page
|
||||
}
|
||||
|
||||
const library = publicLibrary(event, { light })
|
||||
try {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
|
||||
Reference in New Issue
Block a user