mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix ConnectionRequired missing for public routes
This commit is contained in:
parent
6f670d5c3e
commit
9c16515549
4 changed files with 46 additions and 32 deletions
|
@ -17,6 +17,10 @@ $drawer-width: 240px;
|
||||||
left: $drawer-width;
|
left: $drawer-width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// The fallback page has no drawer
|
||||||
|
#fallbackPage {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Hide some items from the user "settings" page that are in the drawer
|
// Hide some items from the user "settings" page that are in the drawer
|
||||||
#myPreferencesMenuPage {
|
#myPreferencesMenuPage {
|
||||||
|
|
|
@ -16,9 +16,11 @@ export const EXPERIMENTAL_APP_ROUTES: RouteObject[] = [
|
||||||
path: '/*',
|
path: '/*',
|
||||||
lazy: () => import('../AppLayout'),
|
lazy: () => import('../AppLayout'),
|
||||||
children: [
|
children: [
|
||||||
|
{ index: true, element: <Navigate replace to='/home.html' /> },
|
||||||
|
|
||||||
{
|
{
|
||||||
/* User routes: Any child route of this layout is authenticated */
|
/* User routes */
|
||||||
element: <ConnectionRequired isUserRequired />,
|
Component: ConnectionRequired,
|
||||||
children: [
|
children: [
|
||||||
...ASYNC_USER_ROUTES.map(toAsyncPageRoute),
|
...ASYNC_USER_ROUTES.map(toAsyncPageRoute),
|
||||||
...LEGACY_USER_ROUTES.map(toViewManagerPageRoute),
|
...LEGACY_USER_ROUTES.map(toViewManagerPageRoute),
|
||||||
|
@ -26,21 +28,26 @@ export const EXPERIMENTAL_APP_ROUTES: RouteObject[] = [
|
||||||
// The video page is special since it combines new controls with the legacy view
|
// The video page is special since it combines new controls with the legacy view
|
||||||
{
|
{
|
||||||
path: 'video',
|
path: 'video',
|
||||||
element: <VideoPage />
|
Component: VideoPage
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
ErrorBoundary
|
ErrorBoundary
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Public routes */
|
|
||||||
{ index: true, element: <Navigate replace to='/home.html' /> },
|
|
||||||
...LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute),
|
|
||||||
|
|
||||||
/* Fallback route for invalid paths */
|
|
||||||
{
|
{
|
||||||
path: '*',
|
/* Public routes */
|
||||||
Component: FallbackRoute
|
element: <ConnectionRequired isUserRequired={false} />,
|
||||||
|
children: [
|
||||||
|
...LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute),
|
||||||
|
|
||||||
|
/* Fallback route for invalid paths */
|
||||||
|
{
|
||||||
|
path: '*',
|
||||||
|
Component: FallbackRoute
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -17,9 +17,11 @@ export const STABLE_APP_ROUTES: RouteObject[] = [
|
||||||
path: '/*',
|
path: '/*',
|
||||||
Component: AppLayout,
|
Component: AppLayout,
|
||||||
children: [
|
children: [
|
||||||
|
{ index: true, element: <Navigate replace to='/home.html' /> },
|
||||||
|
|
||||||
{
|
{
|
||||||
/* User routes */
|
/* User routes */
|
||||||
element: <ConnectionRequired isUserRequired />,
|
Component: ConnectionRequired,
|
||||||
children: [
|
children: [
|
||||||
...ASYNC_USER_ROUTES.map(toAsyncPageRoute),
|
...ASYNC_USER_ROUTES.map(toAsyncPageRoute),
|
||||||
...LEGACY_USER_ROUTES.map(toViewManagerPageRoute)
|
...LEGACY_USER_ROUTES.map(toViewManagerPageRoute)
|
||||||
|
@ -27,15 +29,19 @@ export const STABLE_APP_ROUTES: RouteObject[] = [
|
||||||
ErrorBoundary
|
ErrorBoundary
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Public routes */
|
|
||||||
{ index: true, element: <Navigate replace to='/home.html' /> },
|
|
||||||
...LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute),
|
|
||||||
|
|
||||||
/* Fallback route for invalid paths */
|
|
||||||
{
|
{
|
||||||
path: '*',
|
/* Public routes */
|
||||||
Component: FallbackRoute
|
element: <ConnectionRequired isUserRequired={false} />,
|
||||||
|
children: [
|
||||||
|
...LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute),
|
||||||
|
/* Fallback route for invalid paths */
|
||||||
|
{
|
||||||
|
path: '*',
|
||||||
|
Component: FallbackRoute
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React, { useEffect, useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { Navigate, useLocation } from 'react-router-dom';
|
import { Navigate, useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import loading from 'components/loading/loading';
|
|
||||||
import Page from 'components/Page';
|
import Page from 'components/Page';
|
||||||
import globalize from 'lib/globalize';
|
import globalize from 'lib/globalize';
|
||||||
import LinkButton from 'elements/emby-button/LinkButton';
|
import LinkButton from 'elements/emby-button/LinkButton';
|
||||||
|
@ -9,10 +8,6 @@ import LinkButton from 'elements/emby-button/LinkButton';
|
||||||
const FallbackRoute = () => {
|
const FallbackRoute = () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loading.hide();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// Check if the requested path should be redirected
|
// Check if the requested path should be redirected
|
||||||
const to = useMemo(() => {
|
const to = useMemo(() => {
|
||||||
const _to = {
|
const _to = {
|
||||||
|
@ -42,14 +37,16 @@ const FallbackRoute = () => {
|
||||||
id='fallbackPage'
|
id='fallbackPage'
|
||||||
className='mainAnimatedPage libraryPage'
|
className='mainAnimatedPage libraryPage'
|
||||||
>
|
>
|
||||||
<h1>{globalize.translate('HeaderPageNotFound')}</h1>
|
<div className='padded-left padded-right'>
|
||||||
<p>{globalize.translate('PageNotFound')}</p>
|
<h1>{globalize.translate('HeaderPageNotFound')}</h1>
|
||||||
<LinkButton
|
<p>{globalize.translate('PageNotFound')}</p>
|
||||||
className='button-link'
|
<LinkButton
|
||||||
href='#/home.html'
|
className='button-link'
|
||||||
>
|
href='#/home.html'
|
||||||
{globalize.translate('GoHome')}
|
>
|
||||||
</LinkButton>
|
{globalize.translate('GoHome')}
|
||||||
|
</LinkButton>
|
||||||
|
</div>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue