add global extension check

This commit is contained in:
Jorrin 2024-04-15 23:17:21 +02:00
parent f248a5ff61
commit e2f1f8274b

View File

@ -31,6 +31,7 @@ import { SettingsSyncer } from "@/stores/subtitles/SettingsSyncer";
import { ThemeProvider } from "@/stores/theme"; import { ThemeProvider } from "@/stores/theme";
import { TurnstileProvider } from "@/stores/turnstile"; import { TurnstileProvider } from "@/stores/turnstile";
import { extensionInfo } from "./backend/extension/messaging";
import { initializeChromecast } from "./setup/chromecast"; import { initializeChromecast } from "./setup/chromecast";
import { initializeOldStores } from "./stores/__old/migrations"; import { initializeOldStores } from "./stores/__old/migrations";
@ -140,6 +141,15 @@ function TheRouter(props: { children: ReactNode }) {
return <HashRouter>{props.children}</HashRouter>; return <HashRouter>{props.children}</HashRouter>;
} }
// Checks if the extension is installed
function ExtensionInfoLoader() {
useAsync(async () => {
await extensionInfo();
}, []);
return null;
}
const container = document.getElementById("root"); const container = document.getElementById("root");
const root = createRoot(container!); const root = createRoot(container!);
@ -149,6 +159,7 @@ root.render(
<TurnstileProvider /> <TurnstileProvider />
<HelmetProvider> <HelmetProvider>
<Suspense fallback={<LoadingScreen type="lazy" />}> <Suspense fallback={<LoadingScreen type="lazy" />}>
<ExtensionInfoLoader />
<ThemeProvider applyGlobal> <ThemeProvider applyGlobal>
<ProgressSyncer /> <ProgressSyncer />
<BookmarkSyncer /> <BookmarkSyncer />