You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(koreader): add EPUB progress sync, permission model, and API key editing
Convert between KOReader's DocFragment format and Codex's R2Progression
so EPUB reading progress is shared across all clients (web reader,
KOReader, OPDS apps). Previously, KOReader sync only stored raw page
numbers, breaking cross-client EPUB progress.
Fix the KOReader partial hash algorithm to match LuaJIT's bit.lshift
32-bit wrapping semantics (i=-1 offset is 0, not 256). Recompute
koreader_hash during both scan and analysis, and expose it in the
book API/DTOs.
Add ProgressRead/ProgressWrite permissions so API keys can be scoped
for progress sync without granting broader access. Include these in
all role presets (reader, maintainer, admin) and the OPDS preset.
Add x-auth-user header authentication for KOReader's login flow, which
sends the API key as a username rather than a Bearer token.
Add API key permission editing UI with an edit modal on the profile
settings page. Update OPDS preset to include progress permissions.
Add KOReader setup documentation with troubleshooting guide.
Copy file name to clipboardExpand all lines: docs/docs/third-party-apps.md
+70Lines changed: 70 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,6 +38,76 @@ While Codex is primarily tested with Komic, other Komga-compatible apps may also
38
38
Compatibility with apps other than Komic is not officially tested. Your experience may vary.
39
39
:::
40
40
41
+
### KOReader
42
+
43
+
[KOReader](https://koreader.rocks/) is an open-source e-book reader for E Ink devices and other platforms. Codex supports the KOReader sync protocol, allowing you to sync reading progress between KOReader and Codex.
44
+
45
+
**Supported formats:** EPUB, PDF, CBZ, CBR
46
+
47
+
#### Prerequisites
48
+
49
+
1. **Enable the KOReader API** in your Codex configuration (see [Enabling the KOReader API](#enabling-the-koreader-api) below)
50
+
2. **Create an API key** in Codex (see [API Keys](./users/api-keys))
51
+
3. **Run a deep scan** so Codex computes KOReader-compatible hashes for your books (see [Deep Scan](./libraries#deep-scan))
52
+
53
+
#### Setup in KOReader
54
+
55
+
1. Open a book in KOReader
56
+
2. Go to **Top Menu** > **Tools** (🔧) > **Progress sync**
- **Username**: Your Codex **API key** (e.g., `codex_abc12345_secretpart123456789`)
61
+
- **Password**: Any value (ignored by Codex)
62
+
5. Tap **Login** to verify the connection
63
+
64
+
:::info
65
+
KOReader uses the `x-auth-user` header to send the username, which Codex treats as an API key. The password field (`x-auth-key`) is ignored because KOReader MD5-hashes the password before sending it, making direct password verification impossible.
66
+
:::
67
+
68
+
#### How It Works
69
+
70
+
KOReader identifies books by computing an MD5 hash of the first 4096 bytes of the file. When you enable the KOReader API and run a **deep scan**, Codex computes the same hash for each book and stores it. This allows KOReader to look up books and sync progress.
71
+
72
+
- **Progress sync is per-user**: Each user's reading progress is tracked independently
73
+
- **EPUB progress**: Codex converts between KOReader's DocFragment format and its internal position tracking
74
+
- **PDF/CBZ/CBR progress**: Page numbers are synced directly
75
+
76
+
#### Troubleshooting KOReader
77
+
78
+
**"Login failed" or 401 Unauthorized:**
79
+
- Make sure you're using a Codex **API key** as the username, not your regular username/password
80
+
- Verify the API key hasn't expired or been revoked
81
+
- Check that `koreader_api.enabled` is `true` in your config
82
+
83
+
**"Book not found" (404):**
84
+
- Run a **deep scan** on your library so Codex computes KOReader hashes
85
+
- The book must be in a Codex library; KOReader identifies books by file hash, not filename
86
+
87
+
**Progress not syncing:**
88
+
- Ensure both devices are using the same Codex server and user account
89
+
- Check that the book files are identical (same hash) across devices
90
+
91
+
## Enabling the KOReader API
92
+
93
+
The KOReader sync API is disabled by default. To enable it:
94
+
95
+
### Via Configuration File
96
+
97
+
```yaml
98
+
# codex.yaml
99
+
koreader_api:
100
+
enabled: true
101
+
```
102
+
103
+
### Via Environment Variables
104
+
105
+
```bash
106
+
CODEX_KOREADER_API_ENABLED=true
107
+
```
108
+
109
+
After enabling, restart Codex and run a **deep scan** on your libraries to compute KOReader-compatible file hashes.
110
+
41
111
## Enabling the Komga API
42
112
43
113
The Komga-compatible API is disabled by default for security. To enable it:
0 commit comments