diff --git a/components/profile-modal.html b/components/profile-modal.html index bf2f614d..a677f88d 100644 --- a/components/profile-modal.html +++ b/components/profile-modal.html @@ -973,6 +973,9 @@ +
@@ -1838,3 +1841,88 @@ + + + diff --git a/js/ui/profileModal/ProfileStorageController.js b/js/ui/profileModal/ProfileStorageController.js index 97b5ac99..65e47d10 100644 --- a/js/ui/profileModal/ProfileStorageController.js +++ b/js/ui/profileModal/ProfileStorageController.js @@ -8,6 +8,7 @@ import { import { getActiveSigner } from "../../nostr/client.js"; import { DEFAULT_NIP07_ENCRYPTION_METHODS } from "../../nostr/nip07Permissions.js"; import { storageSyncService } from "../../services/storageSyncService.js"; +import { StorageCorsHelp } from "./storageCorsHelp.js"; export class ProfileStorageController { constructor(mainController) { @@ -34,6 +35,10 @@ export class ProfileStorageController { this.storageR2Helper = null; this.storageB2Helper = null; this.storageS3Helper = null; + // CORS setup helper modal (B2 / Custom S3) — owns its own DOM + behavior. + this.corsHelp = new StorageCorsHelp({ + getBucket: () => this.storageBucketInput?.value?.trim() || "", + }); this.storageForcePathStyleInput = null; this.storageForcePathStyleLabel = null; @@ -67,6 +72,7 @@ export class ProfileStorageController { this.storageR2Helper = document.getElementById("storageR2Helper") || null; this.storageB2Helper = document.getElementById("storageB2Helper") || null; this.storageS3Helper = document.getElementById("storageS3Helper") || null; + this.corsHelp.cacheDom(document); this.storageForcePathStyleInput = document.getElementById("storageForcePathStyle") || null; this.storageForcePathStyleLabel = document.getElementById("storageForcePathStyleLabel") || null; this.storageSyncSection = document.getElementById("profileStorageSync") || null; @@ -123,6 +129,8 @@ export class ProfileStorageController { void this.handleRestoreSync(); }); } + + this.corsHelp.registerEventListeners(); } async populateStoragePane() { @@ -406,8 +414,7 @@ export class ProfileStorageController { updateStorageFormVisibility() { const provider = this.storageProviderInput?.value || "cloudflare_r2"; const isR2 = provider === "cloudflare_r2"; - // B2 derives its endpoint from the region (s3.
+
+
+
+