From c441d630740235a4851f63b376ef9cec4cab9b77 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Sun, 19 Feb 2023 16:05:19 +0100 Subject: [PATCH] normal routing instead of hash Co-authored-by: Jip Frijlink --- src/backend/providers/m4ufree.ts | 1 + src/index.tsx | 16 ++++++++++++---- src/setup/config.ts | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/backend/providers/m4ufree.ts b/src/backend/providers/m4ufree.ts index 78cc2d15..76e558db 100644 --- a/src/backend/providers/m4ufree.ts +++ b/src/backend/providers/m4ufree.ts @@ -29,6 +29,7 @@ registerProvider({ id: "m4ufree", displayName: "m4ufree", rank: -1, + disabled: true, // Disables because the redirector URLs it returns will throw 404 / 403 depending on if you view it in the browser or fetch it respectively. It just does not work. type: [MWMediaType.MOVIE, MWMediaType.SERIES], async scrape({ media, progress, type, episode: episodeId, season: seasonId }) { diff --git a/src/index.tsx b/src/index.tsx index a6bbd66c..3a8d7594 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,6 +1,6 @@ -import React, { Suspense } from "react"; +import React, { ReactNode, Suspense } from "react"; import ReactDOM from "react-dom"; -import { HashRouter } from "react-router-dom"; +import { BrowserRouter, HashRouter } from "react-router-dom"; import { ErrorBoundary } from "@/components/layout/ErrorBoundary"; import { conf } from "@/setup/config"; @@ -42,14 +42,22 @@ const LazyLoadedApp = React.lazy(async () => { }; }); +function TheRouter(props: { children: ReactNode }) { + const normalRouter = conf().NORMAL_ROUTER; + + if (normalRouter) + return + return +} + ReactDOM.render( - + - + , document.getElementById("root") diff --git a/src/setup/config.ts b/src/setup/config.ts index 951be497..72a762f5 100644 --- a/src/setup/config.ts +++ b/src/setup/config.ts @@ -7,6 +7,7 @@ interface Config { OMDB_API_KEY: string; TMDB_API_KEY: string; CORS_PROXY_URL: string; + NORMAL_ROUTER: boolean; } export interface RuntimeConfig extends Config { @@ -20,6 +21,7 @@ const env: Record = { GITHUB_LINK: undefined, DISCORD_LINK: undefined, CORS_PROXY_URL: import.meta.env.VITE_CORS_PROXY_URL, + NORMAL_ROUTER: import.meta.env.VITE_NORMAL_ROUTER, }; const alerts = [] as string[]; @@ -51,5 +53,6 @@ export function conf(): RuntimeConfig { TMDB_API_KEY: getKey("TMDB_API_KEY"), BASE_PROXY_URL: getKey("CORS_PROXY_URL"), CORS_PROXY_URL: `${getKey("CORS_PROXY_URL")}/?destination=`, + NORMAL_ROUTER: (getKey("NORMAL_ROUTER") ?? "false") === "true", }; }