Fix storage credentials persistence on profile switch

This change ensures that cloud storage credentials are not leaked between Nostr profiles when switching accounts in the UI.

Changes:
- Imported `storageService` in `js/app.js` to enable the `bitvid:auth-changed` event listener to correctly lock the previous profile's storage session.
- Updated `ProfileModalController.populateStoragePane` to explicitly clear the storage form before loading new data.
- Enhanced `ProfileModalController.handleClearStorage` to fully reset the form state, including the provider selection and visibility toggles.

Verified with a reproduction script (`reproduce_storage_isolation.mjs`) that `StorageService` correctly isolates data by pubkey at the backend level. The UI fixes address the frontend persistence issue.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-25 18:32:46 +00:00
1 parent 399f57a9a9
commit 94cafc26ab
2 files changed
+5

No files matched your search

+1
View File
@@ -53,6 +53,7 @@ import {
} from "./feedEngine/index.js";
import watchHistoryService from "./watchHistoryService.js";
import r2Service from "./services/r2Service.js";
import storageService from "./services/storageService.js";
import {
getVideoNoteErrorMessage,
normalizeVideoNotePayload,
+4
View File
@@ -8974,6 +8974,8 @@ export class ProfileModalController {
const storageService = this.services.storageService;
const pubkey = this.normalizeHexPubkey(this.getActivePubkey());
this.handleClearStorage();
if (!pubkey) {
// Not logged in
if (this.storageUnlockSection) this.storageUnlockSection.classList.add("hidden");
@@ -9300,6 +9302,8 @@ export class ProfileModalController {
this.storageBucketInput.value = "";
this.storagePrefixInput.value = "";
this.storageDefaultInput.checked = false;
this.storageProviderInput.value = "cloudflare_r2";
this.updateStorageFormVisibility();
this.setStorageFormStatus("", "info");
}