diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index bd77683..04a545d 100755 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -108,10 +108,12 @@ export async function initHomePage(): Promise { // Show loading spinner during home page initialization showHomeLoadingSpinner('Initializing pairing interface...'); - // Initialize iframe pairing, content menu, and communication - initIframePairing(); - initContentMenu(); - initIframeCommunication(); + // Initialize iframe pairing, content menu, and communication only if in iframe + if (window.parent !== window) { + initIframePairing(); + initContentMenu(); + initIframeCommunication(); + } // Set up iframe pairing button listeners setupIframePairingButtons(); diff --git a/src/services/service.ts b/src/services/service.ts index 102eec2..077bf7f 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -829,22 +829,25 @@ export default class Services { publicData: Record, roles: Record ): Promise { - let relayAddress = this.getAllRelays()[0]?.spAddress; - - if (!relayAddress) { - console.log('⏳ Waiting for relays to be ready...'); - // Update UI status - const { updateCreatorStatus } = await import('../utils/sp-address.utils'); - updateCreatorStatus('⏳ Waiting for relays to be ready...'); - - await this.getRelayReadyPromise(); - relayAddress = this.getAllRelays()[0]?.spAddress; - } + // Attendre que le relai soit prêt avec son spAddress + console.log('⏳ Waiting for relays to be ready...'); + // Update UI status + const { updateCreatorStatus } = await import('../utils/sp-address.utils'); + updateCreatorStatus('⏳ Waiting for relays to be ready...'); + + await this.getRelayReadyPromise(); + + // Vérifier que nous avons maintenant un spAddress + const relays = this.getAllRelays(); + const relayAddress = relays.find(relay => relay.spAddress && relay.spAddress.trim() !== '')?.spAddress; if (!relayAddress) { + console.error('Available relays:', relays); throw new Error('❌ No relay address available after waiting'); } + console.log('✅ Relay address found:', relayAddress); + const feeRate = 1; // We can't encode files as the rest because Uint8Array is not valid json