Skip to content

Home: recently read on every device, also what isn't downloaded; audiobooks as cassettes - #371

Merged
9retirement6irk merged 47 commits into
mainfrom
feat/home-server-recent
Nov 23, 2026
Merged

9retirement6irk merged 47 commits into
mainfrom
feat/home-server-recent

Conversation

@9retirement6irk

Copy link
Copy Markdown
Owner

Built on #367 (the BookOrbit chain): merge after it.

What changes for the user

A new option, Recently read on every device, in Settings → Home and tabs → Home → Widgets → Featured book (or Book strip). Off unless turned on.

With it on, Home's current book and its Recent strip also show the books and audiobooks you're in the middle of on your other devices, from Grimmory or BookOrbit, newest first, including ones that aren't on this Kindle.

  • Not on this Kindle: a small arrow in the corner of the cover. A tap shows the book's page with Download and Download & open; an audiobook asks to download it.
  • The current book is the most recent of all, so it can be one that isn't downloaded.
  • Audiobooks are cassettes, the downloaded ones too. On the bookshelf a cassette stands on its side among the books and turns to face out when picked, as a book shows its cover. Nothing else about the bookshelf changes.
  • A book on the Kindle keeps its own entry and moves up when it was read later on another device.
  • The list is what the server has in progress. It's fetched in the background when Wi-Fi is already on (never turned on for it), at most every 10 minutes, and kept for offline.
  • BookOrbit: books come with the e-reader sign-in; audiobooks need the API key (its "Continue listening" shelf, plus one request per audiobook for when it was last played).

How it works

  • gzreader_serverrecent.lua: the list, kept per server and user in the store (titles and times, nothing secret); covers; the cassette picture; what a tap does.
  • Api:continueListening, BookOrbit:continueListening.
  • ZenOS: common/gz_server_recent.lua merges the list into Home's history by time. A book that isn't here has a key (gzserver:<id>) in place of a path. cover_common lets a picture have its own shape and cache key; shelf.lua draws a cassette's side as a spine.

Tested

  • Full suite: 0 suites failed. New checks: times parsed whatever the time zone, the list's order, the merge, Home's records, taps, a failed fetch, BookOrbit with and without a key.
  • Emulator (home_server_recent.lua, demo Grimmory) on Paperwhite 3 and Kindle 3: bookshelf and covers views, a cassette picked on the shelf, the book page and the audiobook question from Home, the option off again.
  • Not tested on a device, and not against a real Grimmory or BookOrbit. BookOrbit's dashboard/scrollers/continue-listening with an API key is from reading its source (3.9); the mock follows that.

To try on a device

  1. Signed in to BookOrbit (API key saved) or Grimmory, Wi-Fi on: Settings → Home and tabs → Home → Widgets → Featured book → tick Recently read on every device.
  2. Go to Home. Within a few seconds the shelf should gain what you're reading elsewhere. Audiobooks are cassettes on their side.
  3. Tap a cassette: it turns to face out. Tap again: it plays, or asks to download.
  4. Tap a book you haven't downloaded (pick it, then tap its cover): its page with Download.
  5. Read a few pages of something on your phone or the web reader, wait 10 minutes (or restart), open Home with Wi-Fi on: that book should now be first.
  6. Untick the option: Home is as before.

If something's off, send the diagnostic log; the lines to look for are recently read: N in progress and any recently read: warning.

Not labelled beta, as with the other BookOrbit PRs. Its only clash with the test build is keeps.txt, which the combine resolves.


Generated by Claude Code

The stand-in the BookOrbit work is tested against: the KOReader sign-in,
version and capabilities, catalog, covers, downloads, match-check, progress
(plugin and KOSync), and the main API's key, audiobook manifest, audio files
and listening position. Written from BookOrbit's routes and field names at
commit e60ab43; none of its code is copied.

tools/gzreader/bookorbit-probe.py asks a real server the same questions and
prints status codes and field names only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
A second client with the Grimmory client's methods (gzreader_bookorbit.lua),
answering in the shapes the Catalog, the index, covers and downloads already
read. plugin.api stays the same table; its class changes with the sign-in
(store.backend). Sign-in is BookOrbit's KOReader sync user: only the
password's MD5 is kept (with the other secrets, off the USB drive).

Nothing is sent to BookOrbit yet (books_only): progress, highlights,
bookmarks, statistics, shelves and audiobooks come in their own steps.

Each server has its own book ids: the other server's list of downloads is
put aside (the files stay), and covers are kept in separate folders.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Grimmory, BookOrbit, or on its own (books sent from a browser). The page
after it offers what fits the answer: the setup page with that server picked,
typing its sign-in, or the Send books page. The guide's sync page says what
is true for the answer. The answer is kept (store.book_source) as the guide's
default; it switches nothing off.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
…g, emulator check)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
… guide's first question

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
run.sh's sections are rewritten by #321, so a new suite there kept this out
of the test build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
… of run_tests.lua

Other open PRs add their blocks at the end of the file, which kept this out
of the test build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
…icates when Python has none

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
…er's does

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
A real server (v3.9.0) lists a book's main file as "primary", not "content":
with only "content" accepted, no book would have downloaded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
…rprint

Progress goes out by the file's fingerprint (KOReader's partial MD5) with
KOReader's own percentage and XPointer, and comes back from the book's
catalog record in the shape gzreader_sync.lua already reads. Books in the
folder that aren't tied to a BookOrbit book are matched with match-check.

What the server takes is in the client's `supports` (main's serverCan);
one sentence built from it says what is and isn't synced, wherever shown.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
gzreader_bo_annotations.lua speaks BookOrbit's exchange: the keys of every
highlight in the book, the ones new or changed since the last exchange, and
back what this Kindle lacks (add, edit, delete), acknowledged once applied.
Same interface as the Grimmory module; main picks by book server.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
gzreader_bo_bookmarks.lua speaks BookOrbit's bookmark exchange (keys of the
book's bookmarks, the new ones, and back what to add and remove; a bookmark
BookOrbit gives is dated here and acknowledged with its key). Only when the
server advertises bookmarkSync. Same interface as the Grimmory module.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
List (books/query), details and chapters (the manifest), download with
resume (asset content, Range), and the listening position both ways
(playback-state, with its revisions and a fresh operation id), all in the
shapes gzreader_audiobook.lua reads Grimmory's in. An audiobook's id here is
"a<id>": a BookOrbit book can be an ebook and an audiobook under one id.

The key is checked at entry (auth/me), kept with the other secrets, never
shown back or logged. The probe now also checks whether the e-reader sign-in
alone can download audio.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Reading time: the page rows of KOReader's statistics database since the last
upload, per BookOrbit book (by fingerprint), to /koreader/plugin/page-stats,
read and sent in a background process a moment after a book closes
(gzreader_bo_stats.lua). Ratings: the client's putRating and the record's
rating, through the existing rating sync.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
A book's menu can change your BookOrbit collections through the main API
(GET collections, POST/DELETE collections/:id/books) when the API key is
saved. Only collections that are yours are offered. Without the key the
menu says where to enter it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
The Catalog's BookOrbit card gets Request a book (title, author, book or
audiobook) and My book requests (state, the decision's note, cancel),
through BookOrbit's book-requests routes with the API key. The key's
setting is now "BookOrbit API key", since collections and requests use
it as well as audiobooks.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
The setup page can sign in to BookOrbit with its address and an API key.
The key (with the KOReader sync permission) reads the account's sync user
name and, from the server's preconfigured-plugin zip, its sync key; the
Kindle then signs in as usual. With no sync sign-in on the account, one
is made under the account's name with a random password. Nothing in the
zip is kept or run, and neither key is logged or shown back.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
… may do

Step 8 groundwork. The probe now sends the browser's preflight and a
signed-in request as the sync page's origin and says whether the server
(its reverse proxy) answers it, and reports what the API key is allowed
to do: the KOReader sync sign-in, collections, book requests. The mock
can stand behind a proxy that lets one origin in.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Home's reading stats widget takes its numbers from the server signed in
to: Grimmory's user stats as before, or BookOrbit's catalog dashboard
(streak, goal, minutes per day for a year, badges). A tap opens a page
with charts drawn from those numbers. The mock gets the dashboard route,
and one comment line in its stand-in zip that matched BookOrbit's source
is reworded.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Async.ensureToken forked a do-nothing "refresh login" process for every
download and index run with BookOrbit (it has no access token to check).
It now answers at once. Grimmory's bookmarks module is required only when
Grimmory is the server. The stats job is tagged "reading stats". A new
emulator tour compares a book session signed in to nothing and to
BookOrbit and lists the requests made.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Caddy and nginx (and Nginx Proxy Manager) rules for the sync page's
origin, what they do and don't allow, and how to check with the probe.
The page itself doesn't speak BookOrbit yet; the wiki says so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
…etting

The key's needed access and permissions are named as BookOrbit's Create
API key page names them, in the setup page, the Kindle's help and the
wiki (with a table per feature). Messages use BookOrbit's real settings
paths. With a key that can see the sync sign-in, GZreader reads how
read-aloud EPUBs are delivered and says so when it's the original with
narration. A sign-in GZreader makes keeps BookOrbit's defaults.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
The tab is Books and the heading names the server, following the Book
server choice. BookOrbit gets its own form (API key first, sync name and
password as the other way, no single sign-on); the other server's fields
are hidden and disabled. Connecting, disconnecting and the Kindle's
summary name the right server. Saving or removing the BookOrbit API key
is confirmed on the page with what the key can do.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
matchLibraryFiles only ran from libraryUpkeep (when the library index
was built), so after switching servers the books already downloaded
still said Download. It now runs 2 s after a BookOrbit sign-in and when
Wi-Fi connects (it does nothing when no file is new or changed).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
gzreader_servername.lua gives the server's own words; the Catalog's
Shelves card, lists and the texts that named Grimmory pass through it.
Grimmory reads as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
#338 gives Gzip.inflate a second argument of its own (a size limit), so
changing its signature here kept this PR and everything built on it out
of the test build.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
…ks as cassettes

An option of Home's current book and Recent strip: they also show the books
and audiobooks in progress on the book server, newest first, also the ones
that aren't on this Kindle (an arrow on the cover; a tap shows the book's
page with Download, or the audiobook's download question). Audiobooks are
drawn as cassettes: on the bookshelf on their side, turned to face out
when picked. Off unless chosen; fetched in the background when Wi-Fi is on.

- gzreader_serverrecent.lua: the list (continueReading + continueListening),
  kept per server and user, covers, the cassette picture, taps
- Api:continueListening, BookOrbit:continueListening (the Continue listening
  shelf, each one's saved position for its time; needs the API key)
- ZenOS: common/gz_server_recent.lua merges it into Home's history; records
  with a key in place of a path; own shape and cache key in cover_common;
  a cassette's side as a spine on the shelf
- tests, mock routes, an emulator tour, wiki, changelog

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
@9retirement6irk 9retirement6irk added the beta Include in the beta branch (test builds over Wi-Fi) label Nov 23, 2026
github-actions Bot added a commit that referenced this pull request Nov 23, 2026
# Conflicts:
#	plugins/gzreader.koplugin/gzreader_changelog.lua
#	tools/gzreader/tests/keeps.txt
@9retirement6irk
9retirement6irk merged commit e9befe1 into main Nov 23, 2026
2 checks passed
@9retirement6irk
9retirement6irk deleted the feat/home-server-recent branch November 23, 2026 03:49
9retirement6irk pushed a commit that referenced this pull request Nov 23, 2026
Sets GZREADER_VERSION and names the changelog's next entry 2026.11.22:
#320-#371 (colour, stickers, emoji, drawing and refresh fixes, BookOrbit,
recently read on every device, date versions, landing page model picker,
Wi-Fi power saving, CI by model, the self-hosted tagline).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqNYrwobY8un97LQ2jriQC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta Include in the beta branch (test builds over Wi-Fi)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants