diff --git a/src/pages/block-sync/block-sync.html b/src/pages/block-sync/block-sync.html index c3249d5..664bc4d 100644 --- a/src/pages/block-sync/block-sync.html +++ b/src/pages/block-sync/block-sync.html @@ -3,135 +3,158 @@ - Synchronisation des Blocs - LeCoffre.io - + Synchronisation des Blocs - LeCoffre

🔄 Synchronisation des Blocs

-

Synchronisation avec le réseau Bitcoin pour récupérer l'historique des transactions

- -
+

Synchronisation avec le réseau Bitcoin pour récupérer l'historique des transactions

+ +
🔄 Initialisation de la synchronisation...
- -
-
+ +
+
- +

📊 Détails de la synchronisation

@@ -155,7 +178,7 @@ 0
- + diff --git a/src/pages/block-sync/block-sync.ts b/src/pages/block-sync/block-sync.ts index 3cf932f..312997e 100644 --- a/src/pages/block-sync/block-sync.ts +++ b/src/pages/block-sync/block-sync.ts @@ -31,11 +31,9 @@ document.addEventListener("DOMContentLoaded", async () => { // Gestion du bouton continuer (définie avant le try pour être toujours disponible) if (continueBtn) { continueBtn.addEventListener('click', async () => { - console.log('🏠 Redirecting to main application...'); - // Rediriger vers l'application principale - console.log('🔄 Block sync completed, checking storage state...'); - const { checkStorageStateAndNavigate } = await import('../../router'); - await checkStorageStateAndNavigate(); + console.log('🔗 Redirecting to pairing page...'); + // Rediriger vers la page de pairing + window.location.href = '/src/pages/home/home.html'; }); } diff --git a/src/pages/wallet-setup/wallet-setup.ts b/src/pages/wallet-setup/wallet-setup.ts index 53568a2..920b583 100644 --- a/src/pages/wallet-setup/wallet-setup.ts +++ b/src/pages/wallet-setup/wallet-setup.ts @@ -80,14 +80,14 @@ document.addEventListener('DOMContentLoaded', async () => { const usedPercent = (memory.usedJSHeapSize / memory.jsHeapSizeLimit) * 100; const usedMB = memory.usedJSHeapSize / 1024 / 1024; const limitMB = memory.jsHeapSizeLimit / 1024 / 1024; - + console.log(`📊 Current memory usage: ${usedPercent.toFixed(1)}% (${usedMB.toFixed(1)}MB / ${limitMB.toFixed(1)}MB)`); - + // Si la mémoire est très élevée (>75%), tenter un nettoyage agressif if (usedPercent > 75) { console.warn('⚠️ High memory usage detected, attempting aggressive cleanup...'); updateStatus('🧹 Nettoyage de la mémoire en cours...', 'loading'); - + // Nettoyage agressif if (window.gc) { for (let i = 0; i < 3; i++) { @@ -95,7 +95,7 @@ document.addEventListener('DOMContentLoaded', async () => { await new Promise(resolve => setTimeout(resolve, 100)); } } - + // Nettoyer les caches HTTP if ('caches' in window) { try { @@ -106,12 +106,12 @@ document.addEventListener('DOMContentLoaded', async () => { console.warn('⚠️ Cache cleanup error:', e); } } - + // Vérifier la mémoire après nettoyage const memoryAfter = (performance as any).memory; const usedPercentAfter = (memoryAfter.usedJSHeapSize / memoryAfter.jsHeapSizeLimit) * 100; console.log(`📊 Memory after cleanup: ${usedPercentAfter.toFixed(1)}% (${(memoryAfter.usedJSHeapSize / 1024 / 1024).toFixed(1)}MB)`); - + // Si toujours >90% après nettoyage, avertir l'utilisateur if (usedPercentAfter > 90) { console.error('❌ Memory still too high after cleanup'); diff --git a/src/services/service.ts b/src/services/service.ts index 7822d9c..edca5bc 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -350,22 +350,22 @@ export default class Services { public async init(): Promise { this.notifications = this.getNotifications(); - + // Vérifier la mémoire avant d'importer WebAssembly if ((performance as any).memory) { const memory = (performance as any).memory; const usedPercent = (memory.usedJSHeapSize / memory.jsHeapSizeLimit) * 100; const availableMB = (memory.jsHeapSizeLimit - memory.usedJSHeapSize) / 1024 / 1024; - + console.log(`📊 Memory check before WebAssembly import: ${usedPercent.toFixed(1)}% used, ${availableMB.toFixed(1)}MB available`); - + // WebAssembly nécessite au moins 150MB de mémoire disponible if (usedPercent > 85 || availableMB < 150) { console.error(`🚫 Memory insufficient for WebAssembly import: ${usedPercent.toFixed(1)}% used, ${availableMB.toFixed(1)}MB available`); throw new Error(`Insufficient memory for WebAssembly. Current usage: ${usedPercent.toFixed(1)}%, Available: ${availableMB.toFixed(1)}MB. Please close other tabs and refresh.`); } } - + this.sdkClient = await import('../../pkg/sdk_client'); this.sdkClient.setup(); for (const wsurl of Object.values(BOOTSTRAPURL)) {