Skip to content

Sync reading data through kDrive; show what other devices read - #8

Merged
Mischou01 merged 2 commits into
mainfrom
sync
Oct 25, 2026
Merged

Mischou01 merged 2 commits into
mainfrom
sync

Conversation

@Mischou01

Copy link
Copy Markdown
Owner

What changes

  • Book cards (src-tauri/src/cards.rs):
    • Each device writes catalog.json in its own folder, plus small covers (cards/<fp>.jpg) for the books being read.
    • Other devices show those books: the library has a folding "On your other devices" group, and Stats and Highlights count them too.
    • These books can't be opened, deleted or edited where the file isn't, and the UI says where they are.
  • Positions per device (Store::positions, src/reader/devicePositions.ts):
    • Opening a book that another device read further in more recently shows "Picked up where Pixel 8 left off", with a "Back to 41%" button.
    • While a book is open, a newer position from another device shows "Pixel 8 is at Chapter 9 · 47%, 6% ahead", with "Go there".
  • kDrive sync (src-tauri/src/sync/):
    • Uses the REST API with a personal token (scope "drive"), as Penultimate does, so it works on every plan.
    • Mirrors .readlet/devices/ with Private/Readlet/devices: this device's folder is pushed and the others' are pulled, and the store merges them as before. Book files never travel.
    • Runs a full pass at launch, when the app returns to the foreground, every 3 minutes, and on "Sync now". Changes are pushed every minute, and on focus or opening a book it refreshes (throttled). Failures back off.
    • Downloads are checked against the store's layout (is_synced_file), so a remote listing can't write anywhere else.
  • Token storage: the system keyring on desktop (keyring 4 with the pure-Rust Secret Service), and AES-GCM with an Android Keystore key on the phone (Secrets.kt). The token is only sent to api.infomaniak.com.
  • Settings › Sync: connect, see status, sync now, turn off, and rename this device.

Checks

  • bun run check passes, with 118 tests.
  • The store, cards, mirror, kDrive client and net modules pass 86 tests and clippy in a standalone crate. The sync service, commands, keyring and Kotlin code are compiled by CI for the first time.
  • The library group, details sheet, Settings flow and Highlights were checked in Playwright with mocked commands.
  • Not yet tried: a real kDrive, and anything on a phone.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DvrowUapeanfHMa7yWfmbT

Mischou01 and others added 2 commits October 25, 2026 19:31
- Book cards: each device writes a catalog of its books (and small covers
  of the ones being read) into its own folder, so the others can show a
  book whose file they don't have: in the library ("On your other
  devices"), stats and highlights.
- Positions per device: opening a book where another device left it says
  so, with a way back; another device reading on while a book is open
  offers to go there. Places are chapters and percentages, not pages.
- kDrive sync (Settings > Sync): with a personal API token, Readlet mirrors
  .readlet/devices/ with a "Readlet" folder in the private kDrive folder.
  This device's folder goes up, the others' come down; the store merges
  them as before. Book files never travel. The token is kept in the
  system keyring, or with an Android keystore key on a phone.
- This device can be renamed, as the others show it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DvrowUapeanfHMa7yWfmbT
…unused constant

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DvrowUapeanfHMa7yWfmbT
@Mischou01
Mischou01 merged commit e5a36b6 into main Oct 25, 2026
6 checks passed
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