Skip to content

feat(paroche): KOSync protocol for ebook reading-progress sync#220

Merged
forkwright merged 2 commits intomainfrom
feat/213-kosync
Apr 22, 2026
Merged

feat(paroche): KOSync protocol for ebook reading-progress sync#220
forkwright merged 2 commits intomainfrom
feat/213-kosync

Conversation

@forkwright
Copy link
Copy Markdown
Owner

Summary

Implements KOSync protocol per /tmp/research-harmonia-213-sync.md §5. Ships 4 endpoints + storage + migrations. KOReader-only v1 (operator Q1 approval); Thorium Reader has no server-side position sync protocol, documented as future work.

Endpoints (under /kosync)

  • POST /users/create — register (username + SHA1 password hash)
  • POST /users/auth — authenticate (returns OK or 401)
  • POST /syncs/progress — upload {document, progress, percentage, device, device_id, timestamp}
  • GET /syncs/progress/{document} — fetch latest position for a doc

Wire-format hash is SHA1(password) per KOReader client convention; documented in-code as "kosync-compat: stronger hashing would break interop."

Storage

Migration 010_kosync.sql adds:

  • kosync_users(username PRIMARY KEY, password_hash, created_at)
  • kosync_positions(username, document, progress, percentage, device, device_id, timestamp) — last-write-wins PK on (username, document).

Deferred (non-goals)

  • OPDS-PS / OPSS — draft spec, no client adoption for EPUB (research §1)
  • Thorium position sync — no server-side protocol exists upstream

Test plan

  • fmt / check / clippy (-D warnings)
  • 153 paroche+apotheke nextest passing
  • create_user_then_auth round-trip
  • progress put/get round-trip
  • last-write-wins on same document
  • cross-device round-trip

Closes #213

🤖 Generated with Claude Code

Cody Kickertz and others added 2 commits April 22, 2026 16:08
Implements the KOSync 4-endpoint wire protocol (POST/users/create, GET/users/auth,
PUT/syncs/progress, GET/syncs/progress/:document) for KOReader cross-device
reading position sync. Includes SHA1-based auth, last-write-wins conflict
resolution, and comprehensive tests. KOReader-only v1; Thorium documented as
future work (no server-side position sync protocol as of 2026).

- Migration 010_kosync.sql: kosync_users + kosync_positions tables
- apotheke::repo::kosync: storage layer + tests
- paroche::routes::kosync: HTTP endpoints + request/response types
- docs/integrations.md: KOReader setup and protocol reference

Closes #213

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@forkwright forkwright merged commit a34b893 into main Apr 22, 2026
1 check passed
@forkwright forkwright deleted the feat/213-kosync branch April 22, 2026 21:12
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.

research: reading progress and device sync (KOSync + OPDS-PS)

1 participant