mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Replace src/utils/setup/App.tsx with src/setup/App.tsx & merge movie-web/dev
This commit is contained in:
parent
4a6395842e
commit
230b86ea8a
2 changed files with 83 additions and 68 deletions
|
@ -1,4 +1,3 @@
|
|||
import { Analytics } from "@vercel/analytics/react";
|
||||
import { ReactElement, Suspense, lazy, useEffect, useState } from "react";
|
||||
import { lazyWithPreload } from "react-lazy-with-preload";
|
||||
import {
|
||||
|
@ -174,7 +173,6 @@ function App() {
|
|||
{showDowntime && (
|
||||
<MaintenancePage onHomeButtonClick={handleButtonClick} />
|
||||
)}
|
||||
<Analytics />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ReactElement, Suspense, lazy, useEffect } from "react";
|
||||
import { ReactElement, Suspense, lazy, useEffect, useState } from "react";
|
||||
import { lazyWithPreload } from "react-lazy-with-preload";
|
||||
import {
|
||||
Navigate,
|
||||
|
@ -16,6 +16,7 @@ import { AboutPage } from "@/pages/About";
|
|||
import { AdminPage } from "@/pages/admin/AdminPage";
|
||||
import VideoTesterView from "@/pages/developer/VideoTesterView";
|
||||
import { DmcaPage, shouldHaveDmcaPage } from "@/pages/Dmca";
|
||||
import MaintenancePage from "@/pages/errors/MaintenancePage";
|
||||
import { NotFoundPage } from "@/pages/errors/NotFoundPage";
|
||||
import { HomePage } from "@/pages/HomePage";
|
||||
import { LoginPage } from "@/pages/Login";
|
||||
|
@ -23,6 +24,7 @@ import { OnboardingPage } from "@/pages/onboarding/Onboarding";
|
|||
import { OnboardingExtensionPage } from "@/pages/onboarding/OnboardingExtension";
|
||||
import { OnboardingProxyPage } from "@/pages/onboarding/OnboardingProxy";
|
||||
import { RegisterPage } from "@/pages/Register";
|
||||
import { SupportPage } from "@/pages/Support";
|
||||
import { Layout } from "@/setup/Layout";
|
||||
import { useHistoryListener } from "@/stores/history";
|
||||
import { LanguageProvider } from "@/stores/language";
|
||||
|
@ -83,80 +85,95 @@ function QueryView() {
|
|||
return null;
|
||||
}
|
||||
|
||||
// Duplicate of @/src/setup/App.tsx
|
||||
function App() {
|
||||
useHistoryListener();
|
||||
useOnlineListener();
|
||||
const maintenance = false; // Changing to true shows maintenance page
|
||||
const [showDowntime, setShowDowntime] = useState(maintenance);
|
||||
|
||||
const handleButtonClick = () => {
|
||||
setShowDowntime(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const sessionToken = sessionStorage.getItem("downtimeToken");
|
||||
if (!sessionToken && maintenance) {
|
||||
setShowDowntime(true);
|
||||
sessionStorage.setItem("downtimeToken", "true");
|
||||
}
|
||||
}, [setShowDowntime, maintenance]);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<LanguageProvider />
|
||||
<Routes>
|
||||
{/* functional routes */}
|
||||
<Route path="/s/:query" element={<QuickSearch />} />
|
||||
<Route path="/search/:type" element={<Navigate to="/browse" />} />
|
||||
<Route path="/search/:type/:query?" element={<QueryView />} />
|
||||
|
||||
{/* pages */}
|
||||
<Route
|
||||
path="/media/:media"
|
||||
element={
|
||||
<LegacyUrlView>
|
||||
{!showDowntime && (
|
||||
<Routes>
|
||||
{/* functional routes */}
|
||||
<Route path="/s/:query" element={<QuickSearch />} />
|
||||
<Route path="/search/:type" element={<Navigate to="/browse" />} />
|
||||
<Route path="/search/:type/:query?" element={<QueryView />} />
|
||||
{/* pages */}
|
||||
<Route
|
||||
path="/media/:media"
|
||||
element={
|
||||
<LegacyUrlView>
|
||||
<Suspense fallback={null}>
|
||||
<PlayerView />
|
||||
</Suspense>
|
||||
</LegacyUrlView>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/media/:media/:season/:episode"
|
||||
element={
|
||||
<LegacyUrlView>
|
||||
<Suspense fallback={null}>
|
||||
<PlayerView />
|
||||
</Suspense>
|
||||
</LegacyUrlView>
|
||||
}
|
||||
/>
|
||||
<Route path="/browse/:query?" element={<HomePage />} />
|
||||
<Route path="/" element={<HomePage />} />
|
||||
<Route path="/register" element={<RegisterPage />} />
|
||||
<Route path="/login" element={<LoginPage />} />
|
||||
<Route path="/about" element={<AboutPage />} />
|
||||
<Route path="/onboarding" element={<OnboardingPage />} />
|
||||
<Route
|
||||
path="/onboarding/extension"
|
||||
element={<OnboardingExtensionPage />}
|
||||
/>
|
||||
<Route path="/onboarding/proxy" element={<OnboardingProxyPage />} />
|
||||
{shouldHaveDmcaPage() ? (
|
||||
<Route path="/dmca" element={<DmcaPage />} />
|
||||
) : null}
|
||||
{/* Support page */}
|
||||
<Route path="/support" element={<SupportPage />} />
|
||||
{/* Settings page */}
|
||||
<Route
|
||||
path="/settings"
|
||||
element={
|
||||
<Suspense fallback={null}>
|
||||
<PlayerView />
|
||||
<SettingsPage />
|
||||
</Suspense>
|
||||
</LegacyUrlView>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/media/:media/:season/:episode"
|
||||
element={
|
||||
<LegacyUrlView>
|
||||
<Suspense fallback={null}>
|
||||
<PlayerView />
|
||||
</Suspense>
|
||||
</LegacyUrlView>
|
||||
}
|
||||
/>
|
||||
<Route path="/browse/:query?" element={<HomePage />} />
|
||||
<Route path="/" element={<HomePage />} />
|
||||
<Route path="/register" element={<RegisterPage />} />
|
||||
<Route path="/login" element={<LoginPage />} />
|
||||
<Route path="/about" element={<AboutPage />} />
|
||||
<Route path="/onboarding" element={<OnboardingPage />} />
|
||||
<Route
|
||||
path="/onboarding/extension"
|
||||
element={<OnboardingExtensionPage />}
|
||||
/>
|
||||
<Route path="/onboarding/proxy" element={<OnboardingProxyPage />} />
|
||||
|
||||
{shouldHaveDmcaPage() ? (
|
||||
<Route path="/dmca" element={<DmcaPage />} />
|
||||
) : null}
|
||||
|
||||
{/* Settings page */}
|
||||
<Route
|
||||
path="/settings"
|
||||
element={
|
||||
<Suspense fallback={null}>
|
||||
<SettingsPage />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* admin routes */}
|
||||
<Route path="/admin" element={<AdminPage />} />
|
||||
|
||||
{/* other */}
|
||||
<Route path="/dev" element={<DeveloperPage />} />
|
||||
<Route path="/dev/video" element={<VideoTesterView />} />
|
||||
{/* developer routes that can abuse workers are disabled in production */}
|
||||
{process.env.NODE_ENV === "development" ? (
|
||||
<Route path="/dev/test" element={<TestView />} />
|
||||
) : null}
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Routes>
|
||||
}
|
||||
/>
|
||||
{/* admin routes */}
|
||||
<Route path="/admin" element={<AdminPage />} />
|
||||
{/* other */}
|
||||
<Route path="/dev" element={<DeveloperPage />} />
|
||||
<Route path="/dev/video" element={<VideoTesterView />} />
|
||||
{/* developer routes that can abuse workers are disabled in production */}
|
||||
{process.env.NODE_ENV === "development" ? (
|
||||
<Route path="/dev/test" element={<TestView />} />
|
||||
) : null}
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Routes>
|
||||
)}
|
||||
{showDowntime && (
|
||||
<MaintenancePage onHomeButtonClick={handleButtonClick} />
|
||||
)}
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
|
Loading…
Reference in a new issue