mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Move public pages to react-router
This commit is contained in:
parent
5cb92899e0
commit
b3195991a3
6 changed files with 90 additions and 126 deletions
|
@ -124,7 +124,7 @@ class AppRouter {
|
|||
isBack: action === Action.Pop
|
||||
});
|
||||
} else {
|
||||
console.info('[appRouter] "%s" route not found', normalizedPath, location);
|
||||
// The route is not registered here, so it should be handled by react-router
|
||||
this.currentRouteInfo = {
|
||||
route: {},
|
||||
path: normalizedPath + location.search
|
||||
|
|
|
@ -24,7 +24,6 @@ import { appRouter, history } from './components/appRouter';
|
|||
import './elements/emby-button/emby-button';
|
||||
import './scripts/autoThemes';
|
||||
import './scripts/libraryMenu';
|
||||
import './scripts/routes';
|
||||
import './components/themeMediaPlayer';
|
||||
import './scripts/autoBackdrops';
|
||||
import { pageClassOn, serverAddress } from './utils/dashboard';
|
||||
|
@ -39,6 +38,10 @@ import { currentSettings } from './scripts/settings/userSettings';
|
|||
import taskButton from './scripts/taskbutton';
|
||||
import App from './App.tsx';
|
||||
|
||||
import './styles/livetv.scss';
|
||||
import './styles/dashboard.scss';
|
||||
import './styles/detailtable.scss';
|
||||
|
||||
function loadCoreDictionary() {
|
||||
const languages = ['af', 'ar', 'be-by', 'bg-bg', 'bn_bd', 'ca', 'cs', 'cy', 'da', 'de', 'el', 'en-gb', 'en-us', 'eo', 'es', 'es_419', 'es-ar', 'es_do', 'es-mx', 'et', 'eu', 'fa', 'fi', 'fil', 'fr', 'fr-ca', 'gl', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'ja', 'kk', 'ko', 'lt-lt', 'lv', 'mr', 'ms', 'nb', 'nl', 'nn', 'pl', 'pr', 'pt', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sq', 'sv', 'ta', 'th', 'tr', 'uk', 'ur_pk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
||||
const translations = languages.map(function (language) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Navigate, Route, Routes } from 'react-router-dom';
|
|||
import { ASYNC_ADMIN_ROUTES, ASYNC_USER_ROUTES, toAsyncPageRoute } from './asyncRoutes';
|
||||
import ConnectionRequired from '../components/ConnectionRequired';
|
||||
import ServerContentPage from '../components/ServerContentPage';
|
||||
import { LEGACY_ADMIN_ROUTES, LEGACY_USER_ROUTES, toViewManagerPageRoute } from './legacyRoutes';
|
||||
import { LEGACY_ADMIN_ROUTES, LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES, toViewManagerPageRoute } from './legacyRoutes';
|
||||
|
||||
const AppRoutes = () => (
|
||||
<Routes>
|
||||
|
@ -28,6 +28,8 @@ const AppRoutes = () => (
|
|||
{/* Public routes */}
|
||||
<Route path='/' element={<ConnectionRequired isUserRequired={false} />}>
|
||||
<Route index element={<Navigate replace to='/home.html' />} />
|
||||
|
||||
{LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute)}
|
||||
</Route>
|
||||
|
||||
{/* Suppress warnings for unhandled routes */}
|
||||
|
|
|
@ -21,4 +21,5 @@ export function toViewManagerPageRoute(route: LegacyRoute) {
|
|||
}
|
||||
|
||||
export * from './admin';
|
||||
export * from './public';
|
||||
export * from './user';
|
||||
|
|
81
src/routes/legacyRoutes/public.ts
Normal file
81
src/routes/legacyRoutes/public.ts
Normal file
|
@ -0,0 +1,81 @@
|
|||
import { LegacyRoute } from '.';
|
||||
|
||||
export const LEGACY_PUBLIC_ROUTES: LegacyRoute[] = [
|
||||
{
|
||||
path: 'addserver.html',
|
||||
pageProps: {
|
||||
controller: 'session/addServer/index',
|
||||
view: 'session/addServer/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'selectserver.html',
|
||||
pageProps: {
|
||||
controller: 'session/selectServer/index',
|
||||
view: 'session/selectServer/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'login.html',
|
||||
pageProps: {
|
||||
controller: 'session/login/index',
|
||||
view: 'session/login/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'forgotpassword.html',
|
||||
pageProps: {
|
||||
controller: 'session/forgotPassword/index',
|
||||
view: 'session/forgotPassword/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'forgotpasswordpin.html',
|
||||
pageProps: {
|
||||
controller: 'session/resetPassword/index',
|
||||
view: 'session/resetPassword/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wizardremoteaccess.html',
|
||||
pageProps: {
|
||||
controller: 'wizard/remote/index',
|
||||
view: 'wizard/remote/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wizardfinish.html',
|
||||
pageProps: {
|
||||
controller: 'wizard/finish/index',
|
||||
view: 'wizard/finish/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wizardlibrary.html',
|
||||
pageProps: {
|
||||
controller: 'dashboard/library',
|
||||
view: 'wizard/library.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wizardsettings.html',
|
||||
pageProps: {
|
||||
controller: 'wizard/settings/index',
|
||||
view: 'wizard/settings/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wizardstart.html',
|
||||
pageProps: {
|
||||
controller: 'wizard/start/index',
|
||||
view: 'wizard/start/index.html'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wizarduser.html',
|
||||
pageProps: {
|
||||
controller: 'wizard/user/index',
|
||||
view: 'wizard/user/index.html'
|
||||
}
|
||||
}
|
||||
];
|
|
@ -1,123 +0,0 @@
|
|||
import '../elements/emby-button/emby-button';
|
||||
import '../elements/emby-input/emby-input';
|
||||
import '../scripts/livetvcomponents';
|
||||
import '../elements/emby-button/paper-icon-button-light';
|
||||
import '../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
import '../elements/emby-collapse/emby-collapse';
|
||||
import '../elements/emby-select/emby-select';
|
||||
import '../elements/emby-checkbox/emby-checkbox';
|
||||
import '../elements/emby-slider/emby-slider';
|
||||
import '../styles/livetv.scss';
|
||||
import '../components/listview/listview.scss';
|
||||
import '../styles/dashboard.scss';
|
||||
import '../styles/detailtable.scss';
|
||||
import { appRouter } from '../components/appRouter';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
console.groupCollapsed('defining core routes');
|
||||
|
||||
function defineRoute(newRoute) {
|
||||
const path = newRoute.alias ? newRoute.alias : newRoute.path;
|
||||
console.debug('defining route: ' + path);
|
||||
newRoute.dictionary = 'core';
|
||||
appRouter.addRoute(path, newRoute);
|
||||
}
|
||||
|
||||
defineRoute({
|
||||
alias: '/addserver.html',
|
||||
path: 'session/addServer/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'session/addServer/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/selectserver.html',
|
||||
path: 'session/selectServer/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'session/selectServer/index',
|
||||
type: 'selectserver'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/login.html',
|
||||
path: 'session/login/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'session/login/index',
|
||||
type: 'login'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/forgotpassword.html',
|
||||
path: 'session/forgotPassword/index.html',
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'session/forgotPassword/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/forgotpasswordpin.html',
|
||||
path: 'session/resetPassword/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'session/resetPassword/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardremoteaccess.html',
|
||||
path: 'wizard/remote/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/remote/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardfinish.html',
|
||||
path: 'wizard/finish/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/finish/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardlibrary.html',
|
||||
path: 'wizard/library.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'dashboard/library'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardsettings.html',
|
||||
path: 'wizard/settings/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/settings/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardstart.html',
|
||||
path: 'wizard/start/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/start/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizarduser.html',
|
||||
path: 'wizard/user/index.html',
|
||||
controller: 'wizard/user/index',
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
});
|
||||
|
||||
console.groupEnd('defining core routes');
|
||||
|
||||
/* eslint-enable indent */
|
Loading…
Add table
Add a link
Reference in a new issue