Skip to content

feat(library): pre-upload duplicate warning + admin cover audit#135

Closed
bndct-devops wants to merge 1 commit into
feat/whats-newfrom
feat/library-hygiene
Closed

feat(library): pre-upload duplicate warning + admin cover audit#135
bndct-devops wants to merge 1 commit into
feat/whats-newfrom
feat/library-hygiene

Conversation

@bndct-devops

Copy link
Copy Markdown
Owner

Overnight run PR 4/12 — stacked on #134; merge in order.

What

  • Upload dedupe warning: the upload dialog hashes files in the browser (WebCrypto sha256, sequential so peak memory is one file's buffer, >512MB skipped) and checks POST /books/check-hashes before sending. Byte-identical files get an amber "Already in your library — will be skipped" note with a link to the existing book. The server already deduped silently on upload; this saves the transfer and tells the user. If the check fails (offline), everything proceeds as before.
  • Admin → Covers: GET /api/admin/covers/audit (admin-only) lists books with missing/unreadable/low-res covers, with dimensions. Threshold 300px — chosen after running against the real dev library: the standard Google Books cover is 329px and looks fine; the audit's real targets are the 98–128px thumbnails it found. Missing covers have a one-click auto-fix that applies the first cover-search candidate (safe: nothing to downgrade); low-res rows deliberately don't auto-fix (a blind refetch could downgrade) and deep-link to the book's cover picker instead.

Verification

  • Backend tests: flags low-res (real 128px JPEG via PIL) + missing + dangling cover path, passes healthy covers, admin-only 403.
  • End-to-end: Covers tab against the dev library found 16/270 real offenders (Berserk 128px, Gantz 98px thumbnails) before threshold tuning; upload dialog with an existing library EPUB shows the duplicate badge (screenshot-verified both).
  • Frontend build/typecheck clean.

Upload dialog: files are sha256-hashed in the browser (sequential, 512MB
cap) and checked via the existing POST /books/check-hashes before upload;
exact duplicates show "already in your library" with a link and are
skipped. The server already deduped silently — this saves the transfer
and makes it visible. Hash-check failures degrade to the old behavior.

Admin -> Covers (GET /admin/covers/audit): flags missing, unreadable, and
low-res covers (PIL header reads only). The floor is 300px — the standard
Google Books cover is 329px and fine in practice; the audit exists for the
98-128px thumbnails. Missing covers offer one-click auto-fix via the
existing cover-candidates + set-cover endpoints (nothing to downgrade);
low-res rows deep-link to the book's cover picker.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bndct-devops
bndct-devops deleted the branch feat/whats-new July 19, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant