mirror of
https://github.com/readest/readest.git
synced 2026-11-29 19:02:28 +00:00
* fix(sync): give HTML chapter files their own sync identity Web-novel downloaders such as the legado and moon KOReader plugins save each chapter as its own HTML file under the book's title and author. The metadata hash, which syncs reading progress across devices, then matched every chapter of the book, so opening a new chapter could pull the previous chapter's position. #7231 does not cover this: a chapter opened for the first time has no save of its own, so a sibling's newer position still wins. HTML files (.html, .htm, .xhtml, .xhtm, .mhtml, .mht) now salt the meta hash with the base filename, as PDFs already do (#5411), in both the KOReader plugin and the app. The app keeps the salted hash from import and never recomputes it on a metadata refresh. Files already opened keep their cached hash; chapters opened after the update get their own. Verified: - Tests that fail without the fix: - spec/syncconfig_spec.lua "gives per-chapter HTML files of one book distinct hashes": expected 'Sword Coming|Fenghuo Xizhuhou||0001', got the hash source without the filename. - import-metahash.test.ts "imports HTML chapters with identical metadata as separate books" (expected the salted hash, got the shared one) and "refreshBookMetadata preserves the salted metaHash for HTML" (expected 'salted-import-hash', got the recomputed hash). - All koplugin busted specs pass (513), luajit syntax check clean; the related app suites pass (34 files); pnpm lint and format:check clean. - On a Kindle with KOReader, two HTML files sharing a title got the same meta_hash_v1 under the old plugin and distinct ones under the fix, each equal to md5 of "<title>|||<basename>". - Not run: the cross-device sync round trip, because sync from that Kindle currently fails for an unrelated reason. Closes #7313 Reported by zzzh3ng on GitHub Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(sync): salt the HTML metaHash when an existing row has none An existing HTML row with no metaHash (imported before metaHashes existed) kept undefined on re-import instead of getting a salted hash. Keep the stored hash only when there is one. Verified: the new import-metahash test "salts the metaHash when re-importing an HTML book that has none" fails without this change (expected undefined to be the salted hash) and passes with it; related suites pass (35 files, 543 tests); pnpm lint and format:check clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| docs | ||
| icons | ||
| library | ||
| locales | ||
| native/localsend-bin | ||
| scripts | ||
| spec | ||
| .busted | ||
| _meta.lua | ||
| main.lua | ||
| readest-sync-api.json | ||
| readest_asynchttp.lua | ||
| readest_i18n.lua | ||
| readest_localsend.lua | ||
| readest_selfupdate.lua | ||
| readest_sporeresponse.lua | ||
| readest_supabaseauth.lua | ||
| readest_syncannotations.lua | ||
| readest_syncauth.lua | ||
| readest_syncclient.lua | ||
| readest_syncconfig.lua | ||
| readest_syncerror.lua | ||
| readest_syncstats.lua | ||
| readest_synctime.lua | ||
| supabase-auth-api.json | ||