From c22fa23353426c2fe22882c7b897174d0cd8c062 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 9 Jul 2026 22:00:21 -0400 Subject: [PATCH] fix(blossom): push the encrypted synced copy after saving Blossom servers [LOCAL] (#30) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The keyless Blossom save returned early without triggering storageSyncService.push (the S3 path does it after saving), so changing Blossom servers never updated the synced copy — it looked like the settings didn't sync. Blossom servers already live in the account record's plaintext meta (which exportAccountRecord ships), so the same push the S3 branch uses now runs after a keyless save: the record is re-encrypted to self and published, and it roams like S3. NOTE: sync export/import needs the account's encryptedMasterKey, which exists once any secret-bearing (S3) connection has been unlocked/saved. A Blossom-ONLY account (no S3 ever) has no master key envelope yet — encrypted sync for that case is a follow-up. Lint + build clean. Local only. Co-Authored-By: Claude Opus 4.8 --- .../profileModal/ProfileStorageController.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/js/ui/profileModal/ProfileStorageController.js b/js/ui/profileModal/ProfileStorageController.js index 2939c752..07cf38d3 100644 --- a/js/ui/profileModal/ProfileStorageController.js +++ b/js/ui/profileModal/ProfileStorageController.js @@ -814,6 +814,29 @@ export class ProfileStorageController { }); this.setStorageFormStatus("Blossom servers saved.", "success"); this.mainController.showSuccess("Blossom storage saved."); + + // Keep the encrypted synced copy current if the user opted in — the + // account record (which carries the Blossom servers in plaintext meta) + // is re-encrypted to self and published, so it roams like the S3 path. + if (storageSyncService.isEnabled(pubkey)) { + try { + const syncResult = await storageSyncService.push(pubkey, { + confirmOverwrite: () => confirmSyncOverwrite(STORAGE_SYNC_LABEL), + }); + if (syncResult?.ok) { + this.setSyncStatus("Synced copy updated.", "success"); + } else if (syncResult?.conflict) { + this.setSyncStatus( + "Synced copy on your account is newer — not overwritten.", + ); + } + } catch (syncError) { + devLogger.warn( + "[ProfileModal] Blossom re-sync after save failed:", + syncError, + ); + } + } } catch (error) { devLogger.error("Failed to save Blossom connection:", error); this.setStorageFormStatus("Failed to save Blossom servers.", "error");