feat(sync): add full sync option for annotations in koplugin, closes #3710 (#3718)

Add "Full sync all annotations" menu item that pushes and pulls all
annotations regardless of the last sync timestamp, enabling users to
sync old highlights that were created before the plugin was installed.

Changes:
- Add full_sync parameter to push/pull that bypasses timestamp filter
  and uses since=0 for pulling all server annotations
- Deduplicate by annotation ID alongside position-based dedup
- Store server ID on pulled annotations and reuse it when pushing
- Parse ISO 8601 timestamps from server to preserve original
  created/updated dates instead of using current time
- Resolve KOReader page numbers from xpointers via getPageFromXPointer
- Resolve Readest page numbers from CFI via getCFIProgress on pull

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Huang Xin
2026-04-01 21:35:48 +08:00
committed by GitHub
parent 74401fc1bb
commit b8ddb5475e
3 changed files with 94 additions and 23 deletions
@@ -86,7 +86,18 @@ export const useNotesSync = (bookKey: string) => {
);
}
if (cfi) {
converted.push({ ...note, cfi, updatedAt: Date.now() });
let page = note.page;
if (view) {
try {
const progress = await view.getCFIProgress(cfi);
if (progress) {
page = progress.location.current + 1;
}
} catch {
// Page resolution failed — keep original page
}
}
converted.push({ ...note, cfi, page, updatedAt: Date.now() });
}
} catch {
// Conversion failed — discard note