56abcb4a6c1d40e6b83c99256cf261796fe933fa
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
56abcb4a6c |
feat(sync): S3-compatible cloud sync provider (#4990)
* feat(sync): S3-compatible cloud sync provider with premium-gated chooser Add a third file-sync backend for any SigV4 object store (Cloudflare R2, AWS S3, MinIO, Backblaze B2), end to end: SigV4 transport via aws4fetch (path-style addressing, ListObjectsV2 with page draining, per-key deletes, presigned streaming on Tauri, Drive-style error mapping and backoff), S3 settings slice and defaults, exclusive provider activation and cross-window flag broadcast, registry memoization, and an Integrations chooser entry plus connect form that validates the bucket with one signed listing. Shared helpers settingsKeyForBackend and cloudProviderDisplayName replace the scattered per-kind ternaries across the reader and library sync hooks, fleet detection, and the settings surfaces. The chooser now marks third-party providers with a Premium badge and enforces the paywall (CLOUD_SYNC_REQUIRES_PREMIUM on): free plans see the rows but route to the upgrade page instead of the config sub-pages, and a downgraded account's still-selected provider is paused rather than silently falling back to Readest Cloud uploads. Manual provider sync now reports "N book(s) synced" like the native cloud sync, from the engine result returned by runActiveFileLibrarySync. The S3 transport passes the same provider semantic contract as WebDAV and Google Drive. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * perf(sync): make the library row the ground truth for local file presence Every sync run re-walked all books whose file is recorded nowhere and paid two plugin:fs|exists IPC per book per run on Tauri, just to relearn "no local source", ending in 0 books synced. The library row already tracks local presence reliably (import, download, and delete all stamp downloadedAt, and the metadata merge keeps it device-local), so the file-push gate now trusts the row: a book the row marks as absent costs zero filesystem and zero remote probes, keeping incremental sync a pure metadata diff at any library size. A session-scoped per-provider memo additionally suppresses re-probes of drifted rows (the row claims a file the filesystem no longer has), keyed to the book's updatedAt so any local change re-qualifies it. Row-vs-filesystem split-brain in either direction is healed by Full Sync, which bypasses the gate, the memo, and the uploaded-file record and audits the real filesystem. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(sync): tiered request timeouts for the WebDAV client An unreachable or dead server (a LAN host that went away) left PROPFIND and HEAD requests pending indefinitely, pinning the Integrations panel on "Syncing..." and the browse pane on a spinner. Metadata round-trips (PROPFIND, HEAD, MKCOL, DELETE) answer with headers only, so they now abort after 5 seconds; GET and PUT carry book-sized bodies over possibly slow links and keep a 5 minute ceiling instead. Expiry aborts the request via AbortController and surfaces as a "Request timed out" NETWORK failure through the existing WebDAVRequestError taxonomy. Since every library sync run opens with the HEAD etag probe on library.json, a dead server now fails the whole run within seconds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(settings): provider panel status and layout fixes Three small fixes across the provider settings panels: - A completed manual "Sync now" clears the provider's lastError so the Cloud Sync chooser row and the SettingsMenu sync row stop reading "Sync failed" after the server comes back; a failed manual run now records the error for those surfaces too. Covered by a render harness that drives the real form against a mocked engine. - The sync row shows a relative "Synced a few seconds ago" label (same wording as the SettingsMenu row) instead of an absolute timestamp. - The Google Drive configured-but-inactive state rendered its Tips above the action buttons; Tips now close the page in every provider panel state. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(i18n): translate the S3 provider and premium gating strings New keys from the S3-compatible provider (form fields, chooser entry, tips), the Premium badge, and the parameterized provider tips, translated across all 33 locales. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore(memory): record the S3 provider and sync optimization notes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
e08622b416 |
feat(sync): route library sync exclusively to the selected cloud provider (#4380) (#4975)
While WebDAV or Google Drive is the selected cloud sync backend, the native Readest Cloud book/progress/note channels are gated off and the file-sync engine owns library data end to end: - isSyncCategoryEnabled returns false for book/progress/note (and their legacy aliases) when a third-party provider is selected. A runtime override, deliberately not written into syncCategories: the user's own toggles persist and take effect again on switch-back. Account channels (settings, stats, dictionaries, fonts, textures, OPDS catalogs) always stay native. - persistActiveCloudProvider is the single write path for provider switching, used by the chooser, both connect/disconnect flows, and the Drive OAuth callback (which previously bypassed the cross-window broadcast). The broadcast carries ONLY the enabled flags plus providerSelectedAt, never credentials or sync cursors, and only on switch events, so a stale window's routine save cannot revert a switch. - buildWebDAVConnectSettings no longer pre-sets enabled: activation belongs to withActiveCloudProvider, so the fresh-connect path now gets the syncBooks auto-flip and the providerSelectedAt stamp. - Sync health: fileSyncStore records lastError per backend; the durable lastSyncedAt stays in provider settings. The SettingsMenu sync row reads Synced via provider / Sync failed and its tap (with pull to refresh and BackupWindow, all routed through pullLibrary) runs the file engine via the shared runActiveFileLibrarySync helper instead of a gated native pull that would toast undefined book(s) synced. - Mixed-fleet detection: while gated, the auto-sync interval runs a read-only probe of /api/sync since providerSelectedAt; any newer book row means another device still syncs natively, and a once-per-session notice explains the fork instead of leaving it silent. - Readest-Cloud-only affordances hide while a third-party provider is selected: the quota row becomes a caption naming the active provider, Auto Upload disappears from the menu and command palette, the BookItem upload badge and the Transfer Queue Upload All button hide. - providerSelectedAt added to both provider settings types and the backup blacklist. Stacked on the quota-decoupling change for #4959; requires the metadata-parity change so gated channels lose nothing users can see. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |