Repository navigation
feat(reader): 在线书目录增量更新与书签迁移导出 - #48
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解决的问题 / Problem
Fixes #46
在线书目录更新只要不是末尾追加(中段增删、重排或章节地址变化),旧逻辑就会整本覆盖章节列表,并按新下标重新分配 cid。书签保存的是旧 cid,更新后会指向“同下标但不同章节”,导致跳转失败或跳错。
同时需要处理旧版本整本覆盖遗留的错位书签,并提供书签 JSON 导出 / 导入,便于人工修复系统无法自动对应的记录。
改动后的行为 / Resulting behavior
content://句柄,浏览器开发环境退回 DOM 下载 / 文件选择。文件上限 16 MB,UTF-8 JSON。未附截图:本次没有准备含在线书和书签的阅读器会话。手动检查时打开任一带书签的在线书,在书签面板确认导出 / 导入按钮,再执行「阅读设置 → 检查书籍更新」,查看目录更新提示与书签迁移数。
验证 / Validation
pnpm exec tsc --noEmit通过。pnpm run i18n:check通过。pnpm build通过。node scripts/bookmarks-toc-test.mjs通过,覆盖错位书签修复、标题 / 正文迁移、导入导出与卷名处理。node scripts/online-volumes-test.mjs通过,覆盖目录增删改、重排、cid 保留与并发回写。cargo test -p readerx-sync通过,167 个单元测试及集成测试全部通过。cargo test -p readerx --lib sync::bridge通过,8 个测试。cargo test -p readerx --lib data_transfer通过,40 个测试。数据与兼容性 / Data and compatibility
chapterVolume,旧记录缺少该字段时按无卷处理;同步桥接bookmark_values/bookmark_value已携带该字段,落地不写 null,保持旧记录形状。readerx-sync将书签chapter_index调整为静默 LWW。书签原文、id 与book_id仍不可变;章节归属和偏移允许随目录更新 / 修复迁移。未改变同步协议版本或数据库user_version。提交前检查 / Checklist