From 0fe23c70201e060758624aaddecb6d7586e1a381 Mon Sep 17 00:00:00 2001 From: wearrrrr Date: Sat, 27 Jul 2024 19:05:01 -0500 Subject: [PATCH] Fix bug with IDB, it should be much more stable now --- src/components/ThemeLoader.astro | 1 - src/components/WelcomeLogging.astro | 7 +++++-- src/components/ts/IDBManager.ts | 1 + src/layouts/Layout.astro | 14 ++++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/components/ThemeLoader.astro b/src/components/ThemeLoader.astro index 572db6e..d6ef40a 100644 --- a/src/components/ThemeLoader.astro +++ b/src/components/ThemeLoader.astro @@ -30,7 +30,6 @@ result.forEach((extension: IExtensionMetadata) => { if (extension.type === "theme" && extension.themeName) { // Load theme CSS - console.log("Attempting to load theme", extension.themeName); loadStyleFromAtob(atob(extension.scriptCopy!)); document.addEventListener("astro:after-swap", () => { diff --git a/src/components/WelcomeLogging.astro b/src/components/WelcomeLogging.astro index f187592..5d48e07 100644 --- a/src/components/WelcomeLogging.astro +++ b/src/components/WelcomeLogging.astro @@ -8,7 +8,10 @@ console.log("%cBrowser: " + navigator.userAgent, `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`); console.log("%cCPU Cores: " + navigator.hardwareConcurrency, `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`); // Cmon firefox, do we really not support this?? Basic stuff here from the "indie browser". - console.log("%cMemory: " + (navigator as any).deviceMemory + "GB", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`); - + if (!navigator.userAgent.includes("Firefox")) { + console.log("%cMemory: " + (navigator as any).deviceMemory + "GB", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`); + } else { + console.log("%cMemory: Not supported in Firefox", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`); + } console.log("%cPlease include this information in a bug report!", `color: ${primaryColor}; font-size: 0.75rem; font-weight: bold;`); diff --git a/src/components/ts/IDBManager.ts b/src/components/ts/IDBManager.ts index a7ba739..4a65df9 100644 --- a/src/components/ts/IDBManager.ts +++ b/src/components/ts/IDBManager.ts @@ -21,6 +21,7 @@ export function loadIDBPromise(name: string, version: number): Promise { const idb = request.result; CurrentIDB = idb; + CurrentIDB.createObjectStore(name, { keyPath: "slug" }); resolve(idb); }; diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 27b0482..83b7fd6 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -58,10 +58,16 @@ const { title, optionalPreloads } = Astro.props;