Skip to content

ADFA-4850: Get More — Books (Project Gutenberg)#259

Merged
luisguzman-adfa merged 5 commits into
mainfrom
feat/ADFA-4850-getmore-books
Jul 24, 2026
Merged

ADFA-4850: Get More — Books (Project Gutenberg)#259
luisguzman-adfa merged 5 commits into
mainfrom
feat/ADFA-4850-getmore-books

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Native "Get More → Books" (Project Gutenberg), the Books counterpart to the merged Wikipedia/ZIM flow (ADFA-4849), plus the dashboard REST it runs on.

What this adds

  • Browse/search the offline Gutenberg catalog with a 2-column cover grid and multi-select; Popular / Educational chips; a language selector that only offers languages present in the catalog.
  • "Add to library" hands the selection to BooksDownloadService: foreground, one book at a time (kind to Project Gutenberg), continuing past failures, per-book retry, Finish clears the session. Each book is a durable REST job; the server fetches the EPUB and uploads it into Calibre-Web. The device only POSTs + polls.
  • "My books" chip lists the local Calibre-Web library; tapping a book opens its Calibre-Web page (details + Read / Download). Reading stays on the home "Read a Book" card, never here.
  • Get More hub cards are gated per module: each card shows only when its endpoint answers (Wikipedia→kiwix, Books→calibre-web, Maps→maps, Courses→kolibri).
  • Covers use a fixed palette with white text so contrast holds in dark mode; selection/library state is shown with a band under the title (gray "Selected" / green "In your books").

Dashboard REST (static/dashboard): /api/books/search (q, filter, lang, limit), /api/books/library, /api/books/library/:id/remove, /api/books/languages.

Verification / coordination

  • Deploy touches dashboard + app: run tools/dev-push-dashboard.sh for the REST changes and rebuild/reinstall the APK for the front.
  • On-device verification pending: end-to-end add (EPUB → Calibre-Web), the "My books" → Calibre-Web book page as guest, and per-module card gating on partial installs.

Extend the durable REST engine so the Books flow is fully REST (the dashboard is becoming the
API). Ports the existing socket.io books handlers:
- GET  /api/books/search?q=&filter=&limit=  → FTS over the offline catalog.db (query MATCH /
  educational / top-by-downloads); returns {gutenberg_id,title,author,language,download_url,
  description,cover_url}. cover_url is derived from the Gutenberg id (no image blobs in the DB).
- GET  /api/books/library                   → Calibre-Web metadata.db EPUB books {id,title,author,year}.
- POST /api/books/library/:id/remove        → Calibre-Web delete.
Download stays the durable job (POST /api/books/download). Paths don't collide with the generic
/:type/* engine routes. tsc --noEmit clean; dist/ is gitignored (built on rootfs push).
…hub cards

Books catalog browse/search with a colored-cover grid and multi-select, feeding
BooksDownloadService (foreground, one book at a time — kind to Project Gutenberg —
continuing past failures, per-book retry, Finish clears the session). BooksClient
talks to the dashboard REST endpoints; reading stays on the home Read a Book card.
Get More hub cards are now conditional on the backing module: Books shows only when
Calibre-Web answers; Kiwix and Maps always show; Courses stays a TBD placeholder.
Each hub card now shows only when its backing module answers a probe
(Wikipedia->kiwix, Books->books/calibre-web, Maps->maps, Courses->kolibri),
instead of only Books being conditional. The hub probes all endpoints on open,
reveals the ones that respond, and shows a checking / empty-state message
otherwise. In a full install nothing changes; on partial installs the hub
reflects exactly what is present.
Covers now use a fixed palette (k2go_cover_*) with white text, so contrast holds
in dark mode — semantic tokens like k2go_ink flip to near-white and hid the label.
Selection/library state moved to a band under the title: green 'In your books',
gray 'Selected' (each with a faint stroke so it reads on any cover), instead of a
faint whole-card tint. Adds a 'My books' chip that lists the local Calibre-Web
library; tapping a book opens its Calibre-Web page (details + Read / Download).
Adds a language selector above the search bar, mirroring the Wikipedia/ZIM flow.
The picker only offers languages actually present in the catalog (new
/api/books/languages returns distinct languages by stock), so there are no dead
options; search takes an optional lang code that narrows every branch. Default is
All languages; the pill is hidden under My books (the local library isn't
catalog-language filtered).
@luisguzman-adfa
luisguzman-adfa merged commit 36c5a16 into main Jul 24, 2026
4 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the feat/ADFA-4850-getmore-books branch July 24, 2026 15:06
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