Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add WASM error detection and show application warning (#276)
Leendert de Borst26c910bf26df
diff --git a/src/AliasVault.Client/wwwroot/index.template.html b/src/AliasVault.Client/wwwroot/index.template.htmlindex 05ead88f5..82382f51e 100644--- a/src/AliasVault.Client/wwwroot/index.template.html+++ b/src/AliasVault.Client/wwwroot/index.template.html@@ -40,16 +40,19 @@<div class="fixed inset-0 flex items-center justify-center"><div class="relative p-8 bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md mx-auto"><div class="text-center">- <svg class="mx-auto animate-spin h-12 w-12 text-primary-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>- </svg>- <h2 class="mt-4 text-xl font-semibold text-gray-900 dark:text-white">AliasVault is loading</h2>- <p class="mt-2 text-sm text-gray-500 dark:text-gray-400">Initializing secure environment. AliasVault prioritizes your privacy, which may take a few seconds.</p>- <div class="loading-progress-text text-sm font-medium text-gray-700 mt-4"></div>- <div class="mt-6 text-center">- <p id="security-quote" class="text-sm text-primary-600 italic"></p>+ <div class="inner">+ <svg class="mx-auto animate-spin h-12 w-12 text-primary-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>+ <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>+ </svg>+ <h2 class="mt-4 text-xl font-semibold text-gray-900 dark:text-white">AliasVault is loading</h2>+ <p class="mt-2 text-sm text-gray-500 dark:text-gray-400">Initializing secure environment. AliasVault prioritizes your privacy, which may take a few seconds.</p>+ <div class="loading-progress-text text-sm font-medium text-gray-700 mt-4"></div>+ <div class="mt-6 text-center">+ <p id="security-quote" class="text-sm text-primary-600 italic"></p>+ </div></div>+ <div id="error-message" class="mt-4 text-red-600 dark:text-red-400 hidden"></div></div></div></div>@@ -86,7 +89,6 @@const checkInterval = 500;const appElement = document.getElementById('app');- const loadingScreen = document.getElementById('loading-screen');appElement.style.visibility = 'hidden';loadingScreen.style.display = 'flex';@@ -95,16 +97,48 @@const elapsedTime = new Date().getTime() - startTime;const hasContent = appElement.innerHTML.trim() !== '';- if ((elapsedTime >= minDisplayTime && hasContent)) {+ if (elapsedTime >= minDisplayTime && hasContent) {loadingScreen.style.display = 'none';appElement.style.removeProperty('visibility');clearInterval(intervalId);+ } else {+ if (elapsedTime % 1000 < checkInterval) {+ if (!('WebAssembly' in window)) {+ showError("AliasVault requires WebAssembly, which this browser does not support. Please use a modern browser that supports WebAssembly.");+ clearInterval(intervalId);+ }+ }}};const intervalId = setInterval(checkContentAndTime, checkInterval);}+ const loadingScreen = document.getElementById('loading-screen');+ const errorMessageElement = document.getElementById('error-message');++ const showError = (message) => {+ loadingScreen.querySelector('.inner').classList.add('hidden');+ errorMessageElement.textContent = message;+ errorMessageElement.classList.remove('hidden');+ document.querySelector('.loading-progress-text').classList.add('hidden');+ document.querySelector('svg.animate-spin').classList.add('hidden');+ };++ // Listen for unhandled errors+ window.addEventListener('error', function(event) {+ if (event.error && event.error.message && event.error.message.includes('WebAssembly')) {+ showError("AliasVault requires WebAssembly, which this browser does not support. Please use a modern browser that supports WebAssembly.");+ }+ });++ // Listen for unhandled promise rejections+ window.addEventListener('unhandledrejection', function(event) {+ if (event.reason && event.reason.message && event.reason.message.includes('WebAssembly')) {+ showError("AliasVault requires WebAssembly, which this browser does not support. Please use a modern browser that supports WebAssembly.");+ }+ });+window.addEventListener('load', manageLoadingScreen);</script><script src="js/crypto.js?v=@CacheBuster" async></script>