Commit Graph
106 Commits
Author SHA1 Message Date
patrick e898069b03 chore: update to ESLint 10
no-useless-assignment joined the recommended set and does not understand runes,
reading every `$bindable()` prop default as a dead store; off for Svelte files.
Carries @eslint/js, @eslint/compat, globals and @types/node with it.
2026-08-17 16:21:43 -04:00
patrick b33f57d942 chore: update frontend dependencies within their semver ranges
SvelteKit 2.53 to 2.70 renamed the remote form enhance callback's `form` to
`element`, which would have thrown on reset in the signup, device, library and
cover forms.
2026-08-17 16:13:42 -04:00
patrick 54043a97d2 feat: check formatting, linting and tests in CI
Every push runs ruff, prettier, pytest and svelte-check; a tagged release runs the
blocking half again before it publishes an image. eslint and svelte-check report
without failing, since 87 and 30 findings predate the workflow.
2026-08-17 15:17:20 -04:00
patrick 45b03764d2 chore: format the tree and clear ruff's findings
Applies ruff format, ruff check --fix and prettier, so CI can gate on all three.
The surviving unused imports were all re-exports in __init__.py, now covered by a
per-file ignore; the pdf.js viewer and the generated openapi types join the
vendored code that eslint and prettier already skip.
2026-08-17 15:17:14 -04:00
patrick b70ed5cb51 feat: build and publish release images from version tags
Tagging v* builds both images on Gitea Actions and pushes them to the instance
registry, then smoke-tests the published stack. The frontend read its backend
URL through import.meta.env, which Vite resolves at build time, so an image
could only point at whatever the build host had; it now reads it at runtime.
2026-08-17 15:05:18 -04:00
patrick 0220f2d970 feat: fetch the next page of books before the reader hits the bottom
The prefetch zone is a viewport deep rather than 200px, and the observer
re-observes after a page lands so a chain of loads is not cut short.
2026-08-17 13:48:40 -04:00
patrick 55e00ba960 feat: import a Calibre library
Reads metadata.db and copies the books into a library — from a zip uploaded on
the library settings page, or from a path with `litestar calibre-import`. The
source is never touched, and re-running only picks up what is new.

Also names the formats mimetypes does not know: a Calibre library is full of
MOBI and AZW3, and a null content type used to fail the book endpoint.
2026-08-17 13:38:44 -04:00
patrick 85367daf7e feat: show books as an import adds them, not once it ends
Refresh the list every couple of seconds while the queue runs, holding off
while the reader has scrolled past the first page.
2026-08-17 11:21:49 -04:00
patrick 7e33a8fe05 Merge branch 'duplicate-detection' 2026-08-17 11:06:23 -04:00
patrick 202cbed30e refactor: name the merge options and drop their subtext 2026-08-17 11:06:19 -04:00
patrick a3443d36f1 feat: offer a merge that keeps the first book, without the workbench 2026-08-17 10:35:35 -04:00
patrick 75fe41e266 fix: reopen the merge dialog after dismissing it 2026-08-17 10:35:24 -04:00
patrick d16a90f08f feat: draw generated covers where a book has none 2026-08-17 10:35:01 -04:00
patrick 904d8fc76f refactor: move duplicates into library settings 2026-08-17 10:32:57 -04:00
patrick 315149e8a2 docs: brief for moving duplicates into library settings
Option B — libraries expand in the settings nav, duplicates becomes a section
within a library's pane.
2026-08-16 20:21:25 -04:00
patrick 699a1a7fa2 feat: merge books from the duplicates screen and the toolbar
A workbench with the folded records in a rail, the survivor's fields live and
editable beside them, and per-field actions chosen by what kind of field it is.
Fields the records agree on stay out of the way. Reachable from a duplicate
group and from the selection toolbar, which is the only way to merge a pair the
detector never proposed.
2026-08-16 20:21:19 -04:00
patrick 22539644a9 feat: merge books into one record
Files move on disk before any row moves, then everything repoints in one
transaction and the folded records are deleted. Progress keeps whichever is
furthest, shelves and tags union, and identifiers move only under a name the
survivor lacks. Metadata is left alone unless the caller resolves it, since
choosing between two titles is a judgement this endpoint cannot make. Nothing
is removed from disk.
2026-08-16 20:21:10 -04:00
patrick a48be517e4 fix: type the ids filter from its configured id type
advanced_alchemy annotates the `ids` query parameter as list[str] whatever the
config says, so a bigint primary key was compared against strings and Postgres
refused. Nothing had called ?ids= until now.
2026-08-16 20:20:44 -04:00
patrick 2e0d556c33 fix: return the publisher an EPUB declares
The lookup discarded its own result and fell off the end of the function, so
no EPUB ever contributed a publisher.
2026-08-16 00:01:02 -04:00
patrick ff75f2c758 chore: clear the lint in the files this branch touches
Unused imports, duplicated import lines, and bare excepts that swallowed
KeyboardInterrupt along with everything else.
2026-08-15 22:01:04 -04:00
patrick e967019964 feat: split the edition out of a book's title
"Fluent Python, 2nd Edition" is one book with a field for the edition. Left in
the title it also splits the library, since the second edition never looks like
the first. Only a numbered statement is moved, so "Catch 22" keeps its number
and "Global Edition" — which has nowhere to go in an integer column — stays put.
2026-08-15 21:57:17 -04:00
patrick f6bb06ac6e fix: merge identifiers across a book's formats
Identifiers are a collection, but the whole dict was replaced per format, so
the last file to report won outright — an EPUB declaring an ASIN, a Google id
and a Calibre id kept none of them once a PDF contributed one ISBN. Accumulate
instead, letting a declared identifier outrank one scraped off a page.
2026-08-15 21:57:01 -04:00
patrick 8ee406533c feat: canonicalise author names
Extractors wrote whatever the file said, so one person held several rows:
"Sam Newman" beside "Newman, Sam;" beside "Sam Newman.epub", the last because
the upload path never stripped the file extension. Tidy on write, in the
validator and in the uniqueness lookup alike, and merge the rows that collide.
2026-08-15 21:56:35 -04:00
patrick 373c96d6d6 fix: match the compact edition markers a cover carries
"Building Microservices, 2E" never matched "Building Microservices". Key the
strip on the trailing "e" so 2E, 5e and 3 Ed are caught, while a bare number
leaves "Catch 22" and "Blade Runner 2049" alone. Stored keys are recomputed.
2026-08-15 21:55:45 -04:00
patrick fc6b97bf38 feat: review and dismiss duplicate books
Adds the per-library review screen, a muted note in the upload tray for a book
that may already be held, and the remote functions behind them. The tray note
is deliberately weaker than the file-level one, which means something stronger.
2026-08-15 21:55:20 -04:00
patrick 5047277845 feat: detect books that may already be in the library
Match on a shared identifier, or on a normalised title credited to a shared
author, and report candidates rather than refusing anything — a metadata match
is a guess, and a second edition is not a mistake. Adds a library-wide review
pass, dismissals, and renames the fingerprint pre-flight to duplicate-files.
2026-08-15 21:55:13 -04:00
patrick 6d1890ce04 feat: store matching keys and duplicate dismissals
Derive normalized_title, normalized_name and normalized_value with @validates
so no write can bypass them, and add the table recording pairs a reader has
said are not the same book.
2026-08-15 21:54:32 -04:00
patrick 523117ec28 fix: keep the identifiers an EPUB declares
DC:identifier was validated verbatim, so hyphenated and urn:isbn: forms never
reached the checksum and every non-ISBN identifier was discarded. Normalise
first, and name whatever survives.
2026-08-15 21:54:12 -04:00
patrick 86e1d096ef feat: add normalisation helpers for book matching
Reduce a title, an author and an identifier to a single comparison key, so
two copies of one book can be recognised by equality rather than by a
similarity score.
2026-08-15 21:44:50 -04:00
patrick 3f39f1f8ae fix: drop the add-anyway override from the upload tray
Storing the same bytes twice splits reading progress and shelves across two
records that can never converge. The skipped row still names the book that
holds the file; allow_duplicates stays on the API for a wrong verdict.
2026-08-14 14:18:08 -04:00
patrick d321315acf fix: ignore duplicate matches whose file is gone
The hash lives in the database and the file does not, so a file deleted behind
the app's back went on refusing its own replacement. Matches are now checked
against disk, and re-adding a book's own missing file writes it back into the
row that already describes it.
2026-08-14 14:18:08 -04:00
patrick b124a65d6e feat: report skipped duplicates in the upload tray
A book whose files were all already stored settles as skipped rather than done,
naming the book that holds them and offering to add it anyway.
2026-08-13 17:23:57 -04:00
patrick d78b21c27f feat: check for duplicate files when importing books
Incoming files are matched against what is already stored, keyed on the
KOReader hash and the file size. Bulk uploads skip and report them, deliberate
creates are refused with a 409, the consume directory parks them aside, and
allow_duplicates overrides all three.

Also: books whose metadata generates a path another book already owns are moved
aside, so a forced copy cannot overwrite the original's files.
2026-08-13 17:23:48 -04:00
patrick 968166c1fd Merge branch 'ui-rewrite' 2026-08-13 13:52:47 -04:00
patrick 8589adbd1b docs: record the outstanding backend issues in TODO.md 2026-08-13 00:42:54 -04:00
patrick 510306f24d fix: keep embedded metadata and group formats on directory upload
The filepath extractor was merged on the right, so a parent folder's name
overrode the title inside the file. Grouping also split a book's formats when
its own folder was the upload root.
2026-08-12 15:17:48 -04:00
patrick bd8d68b9ba fix: resolve file paths and stream the multi-book zip download
file.path is relative to book.path, so the archive matched nothing on disk and
came out empty. Also namespace entries per book to stop filename collisions, and
stream the zip instead of buffering it whole.
2026-08-12 15:17:48 -04:00
patrick 540522e828 fix: reuse existing link rows when updating book relationships
Assigning through the association proxy recreated links for targets the book
already had, colliding with the link tables' unique constraints. Reconcile the
collections in place instead, identifiers included.
2026-08-12 15:17:48 -04:00
patrick 5305d3bb5e docs: correct the CSP entry in TODO.md
Scripted EPUBs are a regression from the foliate migration, not a pre-existing
gap: epub.js sandboxed without allow-scripts by default, foliate sets it
unconditionally. Records grimmory's fix — CSP on per-entry responses rather
than app-wide — which also sidesteps the mode-watcher blocker, plus the
whole-file buffering it would remove.
2026-08-12 14:21:10 -04:00
patrick 7e04826fa5 feat: draw covers for books without one
Full-bleed serif title on a woven ground, drawn in the browser rather than
stored, sized with container queries so one component works from 36px to full
page. Colour is hashed into a list of bookcloth tones instead of the hue wheel.

The grid and search were falling back to default_cover.jpg because a missing
cover made the src "/api/undefined"; they now check for one first.
2026-08-12 13:44:14 -04:00
patrick 96789620bb feat: run book uploads in a background tray
One request per book instead of one for everything, queued in state above the
dialog so closing it no longer cancels the import. A docked tray reports each
book and offers a retry; it clears itself after a clean run, stays put if
anything failed, and holds while hovered.

Also fixes the dialog overflowing on long filenames — Dialog.Content is a grid
and its body needed min-w-0 to shrink below the content's intrinsic width.
2026-08-12 13:42:40 -04:00
patrick d4bdb5ed42 feat: accept files and folders when uploading books
The picker could only choose folders: webkitdirectory switches the OS dialog
into folder mode rather than filtering, so one input cannot offer both. Adds
a drop zone with two browse buttons behind two inputs.

Dropping a folder never worked either — dataTransfer.files does not descend
into directories, so it arrived as one typeless entry and was rejected. Walks
dataTransfer.items instead.

Also collects skipped files into one expandable line rather than a toast each,
which a folder of covers and notes made unusable, and shows the file count and
total size before uploading.
2026-08-12 12:04:14 -04:00
patrick 5f2d68694d feat: rebuild the edit dialog around a cover and files rail
Drops the three tabs for a wide dialog: cover and files in a fixed rail,
all fourteen metadata fields grouped beside them, Save in the footer.

Adds file management, which the Files tab never had — it could only upload,
never list or remove. Files now show size and format with download and
delete, the latter asking whether to remove it from disk too.
2026-08-12 11:40:49 -04:00
patrick d6207b5743 refactor: resolve() internal links instead of plain hrefs
Type-checks every link against the real route tree. Caught a dead one: the
book page linked tags to /tag/{id}, a route that has never existed.
2026-08-12 11:08:09 -04:00
patrick 51c31e6bf6 docs: document the foliate-js reader
Adds a reader section covering the vendored tree, the $foliate alias and the
traps around it, and refreshes the stale stack line, oklch claim and rough
edges. Records why CSP is not enabled in TODO.md.
2026-08-12 01:37:19 -04:00
patrick 961a63480e chore: drop epubjs
Nothing imports it since the foliate rewrite. Also note the one-shot purge of
its locations cache in TODO.md, so the temporary code gets removed later.
2026-08-11 23:15:39 -04:00
patrick 92ffa4f7c2 fix: forward app shortcuts pressed inside the book
Key events do not cross document boundaries, so shortcuts bound on the window
never fired while the book had focus and the browser default won instead —
ctrl+B opened bookmarks rather than the chapter sidebar. Replay them on the
window, cancelling the original only if a handler claimed it so ctrl+C still
copies.
2026-08-11 23:12:00 -04:00
patrick 9155129ccd fix: make the reader's typography, width and arrow keys work
Typography was in the stylesheet foliate prepends, which the book overrides;
moved to the appended one. The window keydown handler was never bound.

Also: wider reading area, page on a card, arrows moved onto it, spread gutter,
and the sidebar stays open on chapter clicks.
2026-08-11 22:45:14 -04:00
patrick 6318115380 fix: make the vendored slider track visible
shadcn-svelte generates the track with `data-horizontal:` / `data-vertical:`
variants, which Tailwind compiles to `[data-horizontal]` — an attribute
nothing sets, since the orientation is carried as data-orientation. The track
got no height, leaving only the thumb on screen. Use the `data-[orientation=…]`
form the rest of ui/ already uses.
2026-08-11 22:43:22 -04:00
patrick fe12f4be76 feat: add the reader settings panel
Typeface, size, weight, line height, letter spacing, justify and hyphenate,
plus flow, columns, line width, gap and margins — persisted in localStorage
and applied live.

Fixed-layout books hide the typography and column controls: they render
through foliate-fxl, which has no setStyles and ignores the paginator's
attributes, so those sliders would do nothing.
2026-08-11 22:27:04 -04:00