Skip to content

BookOrbit: say what the API key needs; check the sign-in's delivery setting - #364

Merged
9retirement6irk merged 37 commits into
mainfrom
fix/bookorbit-key-permissions
Nov 23, 2026
Merged

9retirement6irk merged 37 commits into
mainfrom
fix/bookorbit-key-permissions

Conversation

@9retirement6irk

Copy link
Copy Markdown
Owner

What to tick for the BookOrbit API key, and the KOReader settings GZreader expects. Built on #363 (merge #347 to #363 first, in number order).

What changes for the user

  • Wherever GZreader asks for the API key it says what the key needs, in the words of BookOrbit's Create API key page: Access Read and write; Extra permissions KOReader sync (to sign in with the key) and Request books (to request books); nothing else, and not Administrator access.
  • The wiki's BookOrbit page has two new sections: The API key: what to tick (every row of BookOrbit's page, and a table of which feature needs what) and BookOrbit's KOReader settings (Progress sync, Hide audiobook-only books, Read-aloud EPUB delivery: what GZreader needs of each and why).
  • Messages point at BookOrbit's settings where they are: Settings → You → API keys, Settings → Devices → KOReader, "Progress sync".
  • Read-aloud EPUB delivery is checked. When the key can see the sync sign-in, GZreader reads the setting. If it's Original EPUB with narration (a Kindle can't play the narration, and the files are much bigger), the setup page says so and where to set it to Automatic. GZreader doesn't change it: the sign-in is shared with other e-readers.
  • A sync sign-in the Kindle makes itself (key-only sign-in on an account with none) is sent only a name and a password, so it keeps BookOrbit's defaults: Progress sync on, audiobook-only books hidden, delivery Automatic.

Where the permissions come from

BookOrbit's source (3.9): the audiobook and collection routes ask for no extra permission, only the key's access level and libraries; book requests ask for Request books; the sync sign-in routes ask for KOReader sync. Download books is not needed by that reading, but I haven't tried a key without it on a real server: if audiobook downloads are refused with such a key, that's the box to tick, and tell me.

Tested

Full suite: 0 suites failed. Plugin harness 2860 passed (the key's needs as text, the corrected paths, delivery read at key sign-in and when a key is saved, the advice on the setup page, a made sign-in left on defaults, a key that can't see the sign-in).

To try on a device

  1. Make a key as the wiki's table says (Read and write, KOReader sync, Request books, nothing else) and enter it on the setup page.
  2. Audiobooks should list and download; a book's menu should offer Add to shelf; Request a book should work.
  3. In BookOrbit set Read-aloud EPUB delivery to Original EPUB with narration, save, then save the key again on the setup page: a red line should say so. Set it back to Automatic and save the key again: the line goes.

Not labelled beta, as asked for the BookOrbit PRs.


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
#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
@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
github-actions Bot added a commit that referenced this pull request Nov 23, 2026
# Conflicts:
#	plugins/gzreader.koplugin/gzreader_changelog.lua
github-actions Bot added a commit that referenced this pull request Nov 23, 2026
# Conflicts:
#	plugins/gzreader.koplugin/gzreader_changelog.lua
@9retirement6irk
9retirement6irk merged commit 1d38196 into main Nov 23, 2026
1 check passed
@9retirement6irk
9retirement6irk deleted the fix/bookorbit-key-permissions branch November 23, 2026 03:49
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