From 9c386605623f8bc6a8e3c521b273c0589ce8b69d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 4 Nov 2023 03:23:20 -0400 Subject: [PATCH] fix: check for new indexeddb_error and abort if we get it --- src/components/Browser.tsx | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/components/Browser.tsx b/src/components/Browser.tsx index 629e54d..1c5fcf0 100644 --- a/src/components/Browser.tsx +++ b/src/components/Browser.tsx @@ -79,6 +79,7 @@ async function boot({ onAuth: (authed: boolean) => Promise | void; onBoot: (booted: boolean) => Promise | void; }) { + let err = false; const reg = await navigator.serviceWorker.register("/sw.js"); await reg.update(); @@ -88,9 +89,21 @@ async function boot({ console.error("[Browser.tsx] Failed to init kernel", { error: err }); }); await onInit(true); - await kernelLoaded().catch((err) => { - console.error("[Browser.tsx] Failed to load kernel", { error: err }); - }); + await kernelLoaded() + .then((result) => { + if ("indexeddb_error" === (result as string)) { + alert( + "Error: Please ensure 3rd party cookies are enabled, and any security like brave shield is off, then reload the app", + ); + err = true; + } + }) + .catch((err) => { + console.error("[Browser.tsx] Failed to load kernel", { error: err }); + }); + if (err) { + return; + } await onAuth(true); BOOT_FUNCTIONS.push( @@ -197,7 +210,9 @@ export function Navigator() { (inputEl.current = el)} disabled={!ready} - className={`rounded-l-full bg-neutral-800 text-white border-none focus-visible:ring-offset-0 ${!ready ? "bg-neutral-950" : ""}`} + className={`rounded-l-full bg-neutral-800 text-white border-none focus-visible:ring-offset-0 ${ + !ready ? "bg-neutral-950" : "" + }`} name="url" />