ITADN

Add KeeShare per-device sync support

#2438Pull RequestLcstyle 创建于 2026-02-25
L
Lcstylecommented
## Summary - Implements KeeShare per-device sync mode where each device writes its own container file (`{DEVICE_ID}.kdbx`) into a shared sync directory, eliminating file conflicts between devices - All file I/O through Android's Storage Access Framework (SAF) — no direct filesystem access, no network connections, no sync tool dependencies - Auto-sync via ContentObserver + periodic polling with import-only on detect, export-only on save (matches KeePassXC's `ShareObserver` pattern, prevents feedback loops) - Fixes `DatabaseInputKDBX` ignoring `lastModificationTime` on CustomData during KDBX parse ## What's included | Commit | Description | |--------|-------------| | add KeeShare per-device sync core | DeviceIdentity, KeeShareContainer, KeeShareExport, KeeShareImport, KeeShareReference, PerDeviceSyncConfig + unit tests | | add KeeShare UI, SAF bridge, and sync manager | KeeShareSyncRunnable, KeeShareSyncManager, settings UI, menu integration, share indicator icon | | fix custom data lastModificationTime | `DatabaseInputKDBX.kt` lines 543/595 — CustomData timestamps were being discarded | | add KeeShare documentation | End user guide, technical architecture doc, implementation design notes | | fix KeeShareReference type parsing | Use bitmask flags (ImportFrom=1, ExportTo=2) matching KeePassXC, add keepGroups support | | add sync folder picker | SAF-based folder picker in Settings > KeeShare with persistent URI permissions | | add SAF folder provisioning prompt | On first manual sync, prompts user to pick sync folder if not yet configured | | improve import logging and merge tracking | Per-group config logging, tracks actual new entries merged vs container count | | fix KeeShare sync storm | Auto-triggered syncs import-only (no export), 3s debounce, 5s min-interval guard | | update user guide | First-time setup flow, auto-sync behavior documentation, troubleshooting | ## Design principles - **No file/folder management** — only SAF data streams via `content://` URIs - **No sync tool integration** — works with any folder sync tool (Syncthing, Nextcloud, etc.) - **No network connections** — purely local file operations - **Interoperable with KeePassXC** per-device mode — tested with real Syncthing sync between desktop and Pixel 7 ## Interop Matching KeePassXC implementation: https://github.com/keepassxreboot/keepassxc/discussions/13080 Discussion: https://github.com/Kunzisoft/KeePassDX/discussions/2434 ## Test plan - [x] Build succeeds (assembleLibreDebug + assembleLibreRelease) - [x] Unit tests pass (DeviceIdentity, KeeShareContainer, PerDeviceSyncConfig) - [x] Manual sync imports from KeePassXC container and exports own container - [x] Auto-sync detects new containers via ContentObserver, imports only (no export) - [x] Database save triggers export only (no import) - [x] No sync storm between devices over Syncthing - [x] First-time folder picker prompts correctly - [x] Settings > KeeShare > Sync folder persists across restarts
合并状态:未合并 6 条评论