Support multiple format-aware document identifiers in KOSync
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 28/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- lua
- Domain
- backend-api-design
Research direction
No files or tests are named. Start by tracing the current document-matching request and identifier handling, then review how clients and formats could supply multiple identifiers; done requires an agreed API and matching behavior, including tests for content, filename, and format-specific identifiers.
Written by the indexing model from the issue text.
Description
Problem
KOSync currently matches a document using either the file-content hash or the filename hash. The user must choose one.
Both methods are useful, but both are fragile:
- Content matching breaks when the same book is recompressed, optimized, or repackaged.
- Filename matching breaks when the file is renamed.
- Choosing one method discards the matching value of the other.
- Some KOSync clients do not support filename matching at all.
My use case
I encountered this when trying to synchronize reading progress between Readest and CrossInk.
CrossInk renames and compresses an EPUB when preparing it for the device. Compressing the EPUB makes sense for a storage-constrained reader, but it changes the file contents. Renaming it also changes the filename.
As a result, neither of KOSync's current identifiers matches the original EPUB:
- The content hash no longer matches because the EPUB was compressed.
- The filename hash no longer matches because the file was renamed.
- Even preserving the filename would not fully solve the problem because not every KOSync client supports filename-based matching.
The EPUB still represents the same book and retains metadata such as its title, author, and publisher. A metadata-derived identifier could have allowed it to match.
Suggestion
Could KOSync support multiple identifiers for the same document and match when any of them identifies an existing record?
Instead of choosing:
content OR filename
a client could provide:
content AND filename AND any identifiers supported by the format
Conceptually, a request might include something like:
{
"document": "primary-document-hash",
"identifiers": [
{
"type": "content",
"value": "partial-content-hash"
},
{
"type": "filename",
"value": "filename-hash"
},
{
"type": "epub-package-id",
"value": "package-identifier-hash"
},
{
"type": "metadata",
"value": "title-author-publisher-language-hash"
},
{
"type": "title-author",
"value": "title-author-hash"
}
],
"percentage": 0.42,
"progress": "/body/DocFragment[20]/body/p[22]"
}
This JSON is only intended to illustrate the idea, not prescribe a particular API.
Different formats could provide the identifiers available to them:
- EPUB could use content, filename, package identifier, ISBN, title, author, publisher, and language.
- Audio formats could use content, filename, and their own embedded metadata or identifiers.
- Plain text files might remain limited to content and filename.
The exact identifiers would depend on the format and what each client can reliably extract. Metadata-derived identifiers could remain locally hashed, so the server would not need to receive titles, authors, or filenames in plaintext.
This would preserve exact content matching while allowing renamed, recompressed, or optimized copies of the same document to match through another identifier.
Would multiple format-aware identifiers be a reasonable direction for KOSync?
- Dominant language
- Lua
- Stars
- 824
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from koreader/koreader-sync-server
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 1/5 Under an hour Newbie friendliness 45/100
koreader/koreader-sync-server#48 · 12 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
koreader/koreader-sync-server#47 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
koreader/koreader-sync-server#25 · 6 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
koreader/koreader-sync-server#2 · 4 comments · 1 reaction ·
All issues in koreader/koreader-sync-server
Similar issues
-
bug discord triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:boot area:ci phase:2 priority:P1 type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
wenkais196-Gabriel/T-City#504 ·
Maintainers usually reply within 1 day
-
forever from-game
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openmap-world/openmap#655 ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100