diff --git a/src/components/appRouter.js b/src/components/appRouter.js index 05feb0ff9c..be7cfd5855 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -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 diff --git a/src/index.jsx b/src/index.jsx index 57bdaa2f19..08b3bfada3 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -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) { diff --git a/src/routes/index.tsx b/src/routes/index.tsx index be24c811d8..06e3badaf3 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -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 = () => ( @@ -28,6 +28,8 @@ const AppRoutes = () => ( {/* Public routes */} }> } /> + + {LEGACY_PUBLIC_ROUTES.map(toViewManagerPageRoute)} {/* Suppress warnings for unhandled routes */} diff --git a/src/routes/legacyRoutes/index.tsx b/src/routes/legacyRoutes/index.tsx index b4e97250e9..8f498f98aa 100644 --- a/src/routes/legacyRoutes/index.tsx +++ b/src/routes/legacyRoutes/index.tsx @@ -21,4 +21,5 @@ export function toViewManagerPageRoute(route: LegacyRoute) { } export * from './admin'; +export * from './public'; export * from './user'; diff --git a/src/routes/legacyRoutes/public.ts b/src/routes/legacyRoutes/public.ts new file mode 100644 index 0000000000..0e05875520 --- /dev/null +++ b/src/routes/legacyRoutes/public.ts @@ -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' + } + } +]; diff --git a/src/scripts/routes.js b/src/scripts/routes.js deleted file mode 100644 index d90eb95eaa..0000000000 --- a/src/scripts/routes.js +++ /dev/null @@ -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 */