diff --git a/src/RootAppRouter.tsx b/src/RootAppRouter.tsx index bdd7333f16..bed7a9e4a0 100644 --- a/src/RootAppRouter.tsx +++ b/src/RootAppRouter.tsx @@ -12,6 +12,7 @@ import { EXPERIMENTAL_APP_ROUTES } from 'apps/experimental/routes/routes'; import { STABLE_APP_ROUTES } from 'apps/stable/routes/routes'; import AppHeader from 'components/AppHeader'; import Backdrop from 'components/Backdrop'; +import BangRedirect from 'components/router/BangRedirect'; import { createRouterHistory } from 'components/router/routerHistory'; import UserThemeProvider from 'themes/UserThemeProvider'; @@ -23,7 +24,11 @@ const router = createHashRouter([ element: , children: [ ...(isExperimentalLayout ? EXPERIMENTAL_APP_ROUTES : STABLE_APP_ROUTES), - ...DASHBOARD_APP_ROUTES + ...DASHBOARD_APP_ROUTES, + { + path: '!/*', + Component: BangRedirect + } ] } ]); diff --git a/src/apps/dashboard/routes/_redirects.ts b/src/apps/dashboard/routes/_redirects.ts deleted file mode 100644 index b4d8723041..0000000000 --- a/src/apps/dashboard/routes/_redirects.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { Redirect } from 'components/router/Redirect'; - -export const REDIRECTS: Redirect[] = [ - { from: 'apikeys.html', to: '/dashboard/keys' }, - { from: 'availableplugins.html', to: '/dashboard/plugins/catalog' }, - { from: 'dashboard.html', to: '/dashboard' }, - { from: 'dashboardgeneral.html', to: '/dashboard/settings' }, - { from: 'device.html', to: '/dashboard/devices/edit' }, - { from: 'devices.html', to: '/dashboard/devices' }, - { from: 'edititemmetadata.html', to: '/metadata' }, - { from: 'encodingsettings.html', to: '/dashboard/playback/transcoding' }, - { from: 'installedplugins.html', to: '/dashboard/plugins' }, - { from: 'library.html', to: '/dashboard/libraries' }, - { from: 'librarydisplay.html', to: '/dashboard/libraries/display' }, - { from: 'livetvguideprovider.html', to: '/dashboard/livetv/guide' }, - { from: 'livetvsettings.html', to: '/dashboard/recordings' }, - { from: 'livetvstatus.html', to: '/dashboard/livetv' }, - { from: 'livetvtuner.html', to: '/dashboard/livetv/tuner' }, - { from: 'log.html', to: '/dashboard/logs' }, - { from: 'metadataimages.html', to: '/dashboard/libraries/metadata' }, - { from: 'metadatanfo.html', to: '/dashboard/libraries/nfo' }, - { from: 'networking.html', to: '/dashboard/networking' }, - { from: 'playbackconfiguration.html', to: '/dashboard/playback/resume' }, - { from: 'repositories.html', to: '/dashboard/plugins/repositories' }, - { from: 'scheduledtask.html', to: '/dashboard/tasks/edit' }, - { from: 'scheduledtasks.html', to: '/dashboard/tasks' }, - { from: 'serveractivity.html', to: '/dashboard/activity' }, - { from: 'streamingsettings.html', to: '/dashboard/playback/streaming' }, - { from: 'useredit.html', to: '/dashboard/users/profile' }, - { from: 'userlibraryaccess.html', to: '/dashboard/users/access' }, - { from: 'usernew.html', to: '/dashboard/users/add' }, - { from: 'userparentalcontrol.html', to: '/dashboard/users/parentalcontrol' }, - { from: 'userpassword.html', to: '/dashboard/users/password' }, - { from: 'userprofiles.html', to: '/dashboard/users' } -]; diff --git a/src/apps/experimental/routes/routes.tsx b/src/apps/experimental/routes/routes.tsx index 8f9ed6587f..046f447d65 100644 --- a/src/apps/experimental/routes/routes.tsx +++ b/src/apps/experimental/routes/routes.tsx @@ -1,12 +1,9 @@ import React from 'react'; import { Navigate, RouteObject } from 'react-router-dom'; -import { REDIRECTS } from 'apps/dashboard/routes/_redirects'; import ConnectionRequired from 'components/ConnectionRequired'; import { toAsyncPageRoute } from 'components/router/AsyncRoute'; -import BangRedirect from 'components/router/BangRedirect'; import { toViewManagerPageRoute } from 'components/router/LegacyRoute'; -import { toRedirectRoute } from 'components/router/Redirect'; import ErrorBoundary from 'components/router/ErrorBoundary'; import { ASYNC_USER_ROUTES } from './asyncRoutes'; @@ -38,13 +35,5 @@ export const EXPERIMENTAL_APP_ROUTES: RouteObject[] = [ { index: true, element: }, ...LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute) ] - }, - - { - path: '!/*', - Component: BangRedirect - }, - - /* Redirects for old paths */ - ...REDIRECTS.map(toRedirectRoute) + } ]; diff --git a/src/apps/stable/routes/_redirects.ts b/src/apps/stable/routes/_redirects.ts deleted file mode 100644 index d48c48d995..0000000000 --- a/src/apps/stable/routes/_redirects.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Redirect } from 'components/router/Redirect'; - -export const REDIRECTS: Redirect[] = [ - { from: 'mypreferencesquickconnect.html', to: '/quickconnect' } -]; diff --git a/src/apps/stable/routes/routes.tsx b/src/apps/stable/routes/routes.tsx index 61feac2ad0..787d89ac7f 100644 --- a/src/apps/stable/routes/routes.tsx +++ b/src/apps/stable/routes/routes.tsx @@ -4,15 +4,12 @@ import React from 'react'; import ConnectionRequired from 'components/ConnectionRequired'; import { toAsyncPageRoute } from 'components/router/AsyncRoute'; import { toViewManagerPageRoute } from 'components/router/LegacyRoute'; -import { toRedirectRoute } from 'components/router/Redirect'; import ErrorBoundary from 'components/router/ErrorBoundary'; import AppLayout from '../AppLayout'; -import { REDIRECTS } from './_redirects'; import { ASYNC_USER_ROUTES } from './asyncRoutes'; import { LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes'; -import BangRedirect from 'components/router/BangRedirect'; export const STABLE_APP_ROUTES: RouteObject[] = [ { @@ -33,13 +30,5 @@ export const STABLE_APP_ROUTES: RouteObject[] = [ { index: true, element: }, ...LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute) ] - }, - - { - path: '!/*', - Component: BangRedirect - }, - - /* Redirects for old paths */ - ...REDIRECTS.map(toRedirectRoute) + } ]; diff --git a/src/components/router/Redirect.tsx b/src/components/router/Redirect.tsx deleted file mode 100644 index d68ecdea79..0000000000 --- a/src/components/router/Redirect.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { Navigate, RouteObject, useLocation } from 'react-router-dom'; - -export interface Redirect { - from: string - to: string -} - -const RedirectWithSearch = ({ to }: { to: string }) => { - const { search } = useLocation(); - - return ( - - ); -}; - -export function toRedirectRoute({ from, to }: Redirect): RouteObject { - return { - path: from, - element: - }; -}