mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-01 02:12:26 +00:00
The Storage pane saved every provider into a single shared "default" connection id, so configuring Backblaze B2 overwrote your Cloudflare R2 (and vice-versa). The service layer, upload path, and sync already supported a MAP of connections keyed by id (listConnections / defaultForUploads / exportAccountRecord) — only the UI collapsed them into one slot. - Save each provider under its own slot keyed by provider id (cloudflare_r2 / backblaze_b2 / generic_s3), preserving a single active defaultForUploads and lazily migrating the legacy "default" slot to its provider id. - Switching the provider dropdown now loads that provider's saved credentials (or clears the fields for a fresh entry), so each provider keeps its own creds visibly. - Sync is unchanged: it already exports the whole account record, so every provider's connection syncs together. Logic extracted to js/ui/profileModal/storageConnections.js (saveProviderConnection + pure helpers) so ProfileStorageController stays under the 1000-line cap. Tests: tests/storage-connections.test.mjs (7 — pure default/dup logic + integration proving R2+B2 coexist with one default, the re-default switch, legacy-"default" migration, and that the synced record carries both). Storage + profile-modal suites 69/69; lint clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>