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:
Towsty
2026-09-29 19:45:22 -05:00
co-authored by Cursor
parent 845ee5bbf6
commit aa0aa871e4
10 changed files with 315 additions and 37 deletions
+22 -1
View File
@@ -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)