mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-11 03:15:07 +01:00
Merge pull request #231 from frost768/exclude-dev-routes
Exclude dev routes from production
This commit is contained in:
commit
2fe53a05e8
@ -1,3 +1,4 @@
|
|||||||
|
import { lazy } from "react";
|
||||||
import { Redirect, Route, Switch } from "react-router-dom";
|
import { Redirect, Route, Switch } from "react-router-dom";
|
||||||
import { BookmarkContextProvider } from "@/state/bookmark";
|
import { BookmarkContextProvider } from "@/state/bookmark";
|
||||||
import { WatchedContextProvider } from "@/state/watched";
|
import { WatchedContextProvider } from "@/state/watched";
|
||||||
@ -8,13 +9,8 @@ import { MediaView } from "@/views/media/MediaView";
|
|||||||
import { SearchView } from "@/views/search/SearchView";
|
import { SearchView } from "@/views/search/SearchView";
|
||||||
import { MWMediaType } from "@/backend/metadata/types";
|
import { MWMediaType } from "@/backend/metadata/types";
|
||||||
import { V2MigrationView } from "@/views/other/v2Migration";
|
import { V2MigrationView } from "@/views/other/v2Migration";
|
||||||
import { DeveloperView } from "@/views/developer/DeveloperView";
|
|
||||||
import { VideoTesterView } from "@/views/developer/VideoTesterView";
|
|
||||||
import { ProviderTesterView } from "@/views/developer/ProviderTesterView";
|
|
||||||
import { EmbedTesterView } from "@/views/developer/EmbedTesterView";
|
|
||||||
import { BannerContextProvider } from "@/hooks/useBanner";
|
import { BannerContextProvider } from "@/hooks/useBanner";
|
||||||
import { Layout } from "@/setup/Layout";
|
import { Layout } from "@/setup/Layout";
|
||||||
import { TestView } from "@/views/developer/TestView";
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
@ -44,15 +40,45 @@ function App() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* other */}
|
{/* other */}
|
||||||
<Route exact path="/dev" component={DeveloperView} />
|
{process.env.NODE_ENV === "development" ? (
|
||||||
<Route exact path="/dev/test" component={TestView} />
|
<>
|
||||||
<Route exact path="/dev/video" component={VideoTesterView} />
|
<Route
|
||||||
<Route
|
exact
|
||||||
exact
|
path="/dev"
|
||||||
path="/dev/providers"
|
component={lazy(
|
||||||
component={ProviderTesterView}
|
() => import("@/views/developer/DeveloperView")
|
||||||
/>
|
)}
|
||||||
<Route exact path="/dev/embeds" component={EmbedTesterView} />
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/dev/test"
|
||||||
|
component={lazy(
|
||||||
|
() => import("@/views/developer/TestView")
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/dev/video"
|
||||||
|
component={lazy(
|
||||||
|
() => import("@/views/developer/VideoTesterView")
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/dev/providers"
|
||||||
|
component={lazy(
|
||||||
|
() => import("@/views/developer/ProviderTesterView")
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/dev/embeds"
|
||||||
|
component={lazy(
|
||||||
|
() => import("@/views/developer/EmbedTesterView")
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
<Route path="*" component={NotFoundPage} />
|
<Route path="*" component={NotFoundPage} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
@ -3,7 +3,7 @@ import { ThinContainer } from "@/components/layout/ThinContainer";
|
|||||||
import { ArrowLink } from "@/components/text/ArrowLink";
|
import { ArrowLink } from "@/components/text/ArrowLink";
|
||||||
import { Title } from "@/components/text/Title";
|
import { Title } from "@/components/text/Title";
|
||||||
|
|
||||||
export function DeveloperView() {
|
export default function DeveloperView() {
|
||||||
return (
|
return (
|
||||||
<div className="py-48">
|
<div className="py-48">
|
||||||
<Navigation />
|
<Navigation />
|
||||||
|
@ -105,7 +105,7 @@ function EmbedScraperSelector(props: EmbedScraperSelectorProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function EmbedTesterView() {
|
export default function EmbedTesterView() {
|
||||||
const [embed, setEmbed] = useState<MWEmbed | null>(null);
|
const [embed, setEmbed] = useState<MWEmbed | null>(null);
|
||||||
const [embedScraperId, setEmbedScraperId] = useState<string | null>(null);
|
const [embedScraperId, setEmbedScraperId] = useState<string | null>(null);
|
||||||
const embedScraper = useMemo(
|
const embedScraper = useMemo(
|
||||||
|
@ -96,7 +96,7 @@ function ProviderSelector(props: ProviderSelectorProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ProviderTesterView() {
|
export default function ProviderTesterView() {
|
||||||
const [media, setMedia] = useState<DetailedMeta | null>(null);
|
const [media, setMedia] = useState<DetailedMeta | null>(null);
|
||||||
const [providerId, setProviderId] = useState<string | null>(null);
|
const [providerId, setProviderId] = useState<string | null>(null);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// simple empty view, perfect for putting in tests
|
// simple empty view, perfect for putting in tests
|
||||||
export function TestView() {
|
export default function TestView() {
|
||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ const testMeta: DetailedMeta = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export function VideoTesterView() {
|
export default function VideoTesterView() {
|
||||||
const [video, setVideo] = useState<VideoData | null>(null);
|
const [video, setVideo] = useState<VideoData | null>(null);
|
||||||
const [videoType, setVideoType] = useState<MWStreamType>(MWStreamType.MP4);
|
const [videoType, setVideoType] = useState<MWStreamType>(MWStreamType.MP4);
|
||||||
const [url, setUrl] = useState("");
|
const [url, setUrl] = useState("");
|
||||||
|
Loading…
Reference in New Issue
Block a user