fix(blossom): push the encrypted synced copy after saving Blossom servers [LOCAL] (#30)

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 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-07-09 22:00:21 -04:00
1 parent 18ea5428eb
commit c22fa23353
1 file changed
+23
@@ -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");