Add per-user library settings, folder passwords, and a still picker.

Settings manages folders, thumbnail defaults, and passwords for the signed-in account, and choosing an image now browses saved stills instead of only the desktop file dialog.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-25 18:31:04 -05:00
co-authored by Cursor
parent c4e6af9f77
commit f0f80b5873
20 changed files with 1063 additions and 236 deletions
+14 -9
View File
@@ -1,14 +1,19 @@
export default defineEventHandler(async (event) => {
const body = await readBody<{ password?: string; currentPassword?: string }>(event)
if (isLibraryLocked() && !(await verifyLibraryPassword(String(body?.currentPassword || '')))) {
throw createError({ statusCode: 401, statusMessage: 'Current library password is incorrect' })
const { owner } = assertLibraryOwner(event)
const body = await readBody<{ folderId?: string; password?: string; currentPassword?: string }>(event)
const folderId = String(body?.folderId || '')
if (!folderId) {
throw createError({ statusCode: 400, statusMessage: 'Choose a folder to protect' })
}
const next = String(body?.password || '').trim()
if (next && next.length < 4) {
throw createError({ statusCode: 400, statusMessage: 'Use at least 4 characters, or leave blank to remove the password' })
await updateFolder(owner, folderId, {
password: body?.password ?? '',
currentPassword: body?.currentPassword
})
const folder = assertLibraryOwner(event).catalog.folders.find(item => item.id === folderId)
if (folder?.passwordHash) {
setFolderUnlock(event, folder.id, passwordVersion(folder.passwordHash))
} else {
clearFolderUnlock(event, folderId)
}
const version = await setLibraryPassword(next || null)
if (next) setLibraryUnlock(event, version)
else clearLibraryUnlock(event)
return publicLibrary(event)
})