mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
normal routing instead of hash
Co-authored-by: Jip Frijlink <JipFr@users.noreply.github.com>
This commit is contained in:
parent
a0751380e5
commit
c441d63074
3 changed files with 16 additions and 4 deletions
|
@ -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 }) {
|
||||
|
|
|
@ -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 <BrowserRouter children={props.children} />
|
||||
return <HashRouter children={props.children} />
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<ErrorBoundary>
|
||||
<HashRouter>
|
||||
<TheRouter>
|
||||
<Suspense fallback="">
|
||||
<LazyLoadedApp />
|
||||
</Suspense>
|
||||
</HashRouter>
|
||||
</TheRouter>
|
||||
</ErrorBoundary>
|
||||
</React.StrictMode>,
|
||||
document.getElementById("root")
|
||||
|
|
|
@ -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<keyof Config, undefined | string> = {
|
|||
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",
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue