sudo-archive/src/index.tsx

65 lines
1.7 KiB
TypeScript
Raw Normal View History

import React, { ReactNode, Suspense } from "react";
2022-02-16 20:30:12 +00:00
import ReactDOM from "react-dom";
import { BrowserRouter, HashRouter } from "react-router-dom";
2022-12-13 22:50:13 +00:00
import { ErrorBoundary } from "@/components/layout/ErrorBoundary";
2023-01-07 20:36:18 +00:00
import { conf } from "@/setup/config";
import App from "@/setup/App";
import "@/setup/i18n";
import "@/setup/index.css";
2023-01-11 20:16:48 +00:00
import "@/backend";
2023-01-25 20:44:15 +00:00
import { initializeChromecast } from "./setup/chromecast";
import { initializeStores } from "./utils/storage";
2022-12-29 17:25:57 +00:00
// initialize
const key =
(window as any)?.__CONFIG__?.VITE_KEY ?? import.meta.env.VITE_KEY ?? null;
if (key) {
(window as any).initMW(conf().BASE_PROXY_URL, key);
}
2023-01-25 20:44:15 +00:00
initializeChromecast();
2021-07-13 22:31:37 +00:00
2023-01-13 23:30:50 +00:00
// TODO video todos:
2023-01-16 20:26:01 +00:00
// - chrome cast support
2023-02-04 18:18:14 +00:00
// - bug: safari fullscreen will make video overlap player controls
2023-01-13 23:30:50 +00:00
// TODO stuff to test:
// - browser: firefox, chrome, edge, safari desktop
// - phones: android firefox, android chrome, iphone safari
// - devices: ipadOS
2023-01-16 20:25:16 +00:00
// - HLS
// - HLS error handling
// - video player error handling
// TODO backend system:
// - implement jons providers/embedscrapers
// - AFTER all that: rank providers/embedscrapers
2023-01-13 23:30:50 +00:00
const LazyLoadedApp = React.lazy(async () => {
await initializeStores();
return {
default: App,
};
});
function TheRouter(props: { children: ReactNode }) {
const normalRouter = conf().NORMAL_ROUTER;
if (normalRouter)
return <BrowserRouter children={props.children} />
return <HashRouter children={props.children} />
}
2021-07-13 22:31:37 +00:00
ReactDOM.render(
2022-02-16 20:30:12 +00:00
<React.StrictMode>
<ErrorBoundary>
<TheRouter>
2022-12-17 08:54:27 +00:00
<Suspense fallback="">
<LazyLoadedApp />
2022-12-17 08:54:27 +00:00
</Suspense>
</TheRouter>
2022-02-16 20:30:12 +00:00
</ErrorBoundary>
</React.StrictMode>,
document.getElementById("root")
2021-07-13 22:31:37 +00:00
);