diff --git a/src/pages/home/home.html b/src/pages/home/home.html index e8d9a6c..2a7c2f2 100755 --- a/src/pages/home/home.html +++ b/src/pages/home/home.html @@ -15,8 +15,6 @@ - -
diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index df13f02..be7a485 100755 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -524,34 +524,21 @@ export function setupIframePairingButtons() { } } -// Main Pairing Interface +// Main Pairing Interface - Auto-triggered, no button needed export function setupMainPairing(): void { - const container = getCorrectDOM('login-4nk-component') as HTMLElement; - - const mainPairingButton = container.querySelector('#mainPairingButton') as HTMLButtonElement; - const mainStatus = container.querySelector('#main-status') as HTMLElement; - - if (mainPairingButton) { - mainPairingButton.addEventListener('click', async () => { - await handleMainPairing(); - }); - } + // No button setup needed since authentication is automatic + console.log('🔐 Main pairing setup - authentication will be automatic'); } async function handleMainPairing(): Promise { const container = getCorrectDOM('login-4nk-component') as HTMLElement; const mainStatus = container.querySelector('#main-status') as HTMLElement; - const mainPairingButton = container.querySelector('#mainPairingButton') as HTMLButtonElement; - + try { // Update UI if (mainStatus) { mainStatus.innerHTML = '
Authenticating with browser...'; } - if (mainPairingButton) { - mainPairingButton.disabled = true; - mainPairingButton.textContent = 'Authenticating...'; - } // Always trigger WebAuthn flow for authentication console.log('🔐 Triggering WebAuthn authentication...'); @@ -594,23 +581,12 @@ async function handleMainPairing(): Promise { // Now proceed with pairing process await prepareAndSendPairingTx(); - // Re-enable button - if (mainPairingButton) { - mainPairingButton.disabled = false; - mainPairingButton.textContent = 'Authenticate with Browser'; - } - } catch (error) { console.error('Pairing failed:', error); - + if (mainStatus) { mainStatus.innerHTML = '❌ Authentication failed'; } - - if (mainPairingButton) { - mainPairingButton.disabled = false; - mainPairingButton.textContent = 'Authenticate with Browser'; - } } } diff --git a/src/router.ts b/src/router.ts index 2316209..a7bb116 100755 --- a/src/router.ts +++ b/src/router.ts @@ -55,7 +55,7 @@ async function handleLocation(path: string) { 'width: 100vw; height: 100vh; position: relative; grid-row: 2;' ); if (container) container.appendChild(accountComponent); - + // Initialize the home page after component is added to DOM console.log('🏠 Initializing home page...'); try { @@ -164,8 +164,10 @@ export async function init(): Promise { try { console.log('🌐 Connecting to relays...'); await services.connectAllRelays(); + console.log('✅ Relays connected successfully'); } catch (error) { console.warn('⚠️ Failed to connect to some relays:', error); + console.log('🔄 Continuing despite relay connection issues...'); } // We register all the event listeners if we run in an iframe