reading: owner archive / restore / delete / merge for books (⋯ menu on cards, rows and detail pages), archived filter, tombstones so merged ids redirect and the ingest never recreates deleted works, books-quarantine.py for deleted files
Deploy production / deploy (push) Successful in 1m11s

This commit is contained in:
stan committed 2026-10-25 14:22:40 +00:00
1 parent 8a8ed1642e
commit 27987fb8e7
17 files changed
+27812 -28

No files matched your search

@@ -1,6 +1,7 @@
// Public cover images for the catalogue (covers only, never book files).
import { error } from '@sveltejs/kit';
import { eq } from 'drizzle-orm';
import { and, eq, isNull } from 'drizzle-orm';
import { isOwner } from '#lib/server/owner.js';
import { db } from '#lib/server/db/index.js';
import { bookWorks } from '#lib/server/db/schema/index.js';
import { safeResolve, streamFile } from '#lib/server/books/files.js';
@@ -10,7 +11,12 @@ export const GET: RequestHandler = async (event) => {
const [work] = await db
.select({ coverPath: bookWorks.coverPath })
.from(bookWorks)
.where(eq(bookWorks.id, Number(event.params.id)))
.where(
and(
eq(bookWorks.id, Number(event.params.id)),
isOwner(event) ? undefined : isNull(bookWorks.archivedAt)
)
)
.limit(1);
const resolved = work?.coverPath ? await safeResolve('covers', work.coverPath) : null;
if (!resolved) error(404, 'Not Found');