1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Remove hash bang paths

This commit is contained in:
Bill Thornton 2022-06-09 14:54:39 -04:00
parent 1dbbb4c65d
commit 90b1b45f26
26 changed files with 136 additions and 132 deletions

View file

@ -73,9 +73,13 @@ class AppRouter {
async show(path, options) {
if (this.promiseShow) await this.promiseShow;
// ensure the path does not start with '#!' since the router adds this
if (path.startsWith('#!')) {
path = path.substring(2);
// ensure the path does not start with '#' since the router adds this
if (path.startsWith('#')) {
path = path.substring(1);
}
// Support legacy '#!' routes since people may have old bookmarks, etc.
if (path.startsWith('!')) {
path = path.substring(1);
}
if (path.indexOf('/') !== 0 && path.indexOf('://') === -1) {
@ -515,27 +519,27 @@ class AppRouter {
const serverId = item.ServerId || options.serverId;
if (item === 'settings') {
return '#!/mypreferencesmenu.html';
return '#/mypreferencesmenu.html';
}
if (item === 'wizard') {
return '#!/wizardstart.html';
return '#/wizardstart.html';
}
if (item === 'manageserver') {
return '#!/dashboard.html';
return '#/dashboard.html';
}
if (item === 'recordedtv') {
return '#!/livetv.html?tab=3&serverId=' + options.serverId;
return '#/livetv.html?tab=3&serverId=' + options.serverId;
}
if (item === 'nextup') {
return '#!/list.html?type=nextup&serverId=' + options.serverId;
return '#/list.html?type=nextup&serverId=' + options.serverId;
}
if (item === 'list') {
let url = '#!/list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
let url = '#/list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
if (options.isFavorite) {
url += '&IsFavorite=true';
@ -546,61 +550,61 @@ class AppRouter {
if (item === 'livetv') {
if (options.section === 'programs') {
return '#!/livetv.html?tab=0&serverId=' + options.serverId;
return '#/livetv.html?tab=0&serverId=' + options.serverId;
}
if (options.section === 'guide') {
return '#!/livetv.html?tab=1&serverId=' + options.serverId;
return '#/livetv.html?tab=1&serverId=' + options.serverId;
}
if (options.section === 'movies') {
return '#!/list.html?type=Programs&IsMovie=true&serverId=' + options.serverId;
return '#/list.html?type=Programs&IsMovie=true&serverId=' + options.serverId;
}
if (options.section === 'shows') {
return '#!/list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId;
return '#/list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId;
}
if (options.section === 'sports') {
return '#!/list.html?type=Programs&IsSports=true&serverId=' + options.serverId;
return '#/list.html?type=Programs&IsSports=true&serverId=' + options.serverId;
}
if (options.section === 'kids') {
return '#!/list.html?type=Programs&IsKids=true&serverId=' + options.serverId;
return '#/list.html?type=Programs&IsKids=true&serverId=' + options.serverId;
}
if (options.section === 'news') {
return '#!/list.html?type=Programs&IsNews=true&serverId=' + options.serverId;
return '#/list.html?type=Programs&IsNews=true&serverId=' + options.serverId;
}
if (options.section === 'onnow') {
return '#!/list.html?type=Programs&IsAiring=true&serverId=' + options.serverId;
return '#/list.html?type=Programs&IsAiring=true&serverId=' + options.serverId;
}
if (options.section === 'channels') {
return '#!/livetv.html?tab=2&serverId=' + options.serverId;
return '#/livetv.html?tab=2&serverId=' + options.serverId;
}
if (options.section === 'dvrschedule') {
return '#!/livetv.html?tab=4&serverId=' + options.serverId;
return '#/livetv.html?tab=4&serverId=' + options.serverId;
}
if (options.section === 'seriesrecording') {
return '#!/livetv.html?tab=5&serverId=' + options.serverId;
return '#/livetv.html?tab=5&serverId=' + options.serverId;
}
return '#!/livetv.html?serverId=' + options.serverId;
return '#/livetv.html?serverId=' + options.serverId;
}
if (itemType == 'SeriesTimer') {
return '#!/details?seriesTimerId=' + id + '&serverId=' + serverId;
return '#/details?seriesTimerId=' + id + '&serverId=' + serverId;
}
if (item.CollectionType == 'livetv') {
return '#!/livetv.html';
return '#/livetv.html';
}
if (item.Type === 'Genre') {
url = '#!/list.html?genreId=' + item.Id + '&serverId=' + serverId;
url = '#/list.html?genreId=' + item.Id + '&serverId=' + serverId;
if (context === 'livetv') {
url += '&type=Programs';
@ -614,7 +618,7 @@ class AppRouter {
}
if (item.Type === 'MusicGenre') {
url = '#!/list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
url = '#/list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
if (options.parentId) {
url += '&parentId=' + options.parentId;
@ -624,7 +628,7 @@ class AppRouter {
}
if (item.Type === 'Studio') {
url = '#!/list.html?studioId=' + item.Id + '&serverId=' + serverId;
url = '#/list.html?studioId=' + item.Id + '&serverId=' + serverId;
if (options.parentId) {
url += '&parentId=' + options.parentId;
@ -635,7 +639,7 @@ class AppRouter {
if (context !== 'folders' && !itemHelper.isLocalItem(item)) {
if (item.CollectionType == 'movies') {
url = '#!/movies.html?topParentId=' + item.Id;
url = '#/movies.html?topParentId=' + item.Id;
if (options && options.section === 'latest') {
url += '&tab=1';
@ -645,7 +649,7 @@ class AppRouter {
}
if (item.CollectionType == 'tvshows') {
url = '#!/tv.html?topParentId=' + item.Id;
url = '#/tv.html?topParentId=' + item.Id;
if (options && options.section === 'latest') {
url += '&tab=1';
@ -655,7 +659,7 @@ class AppRouter {
}
if (item.CollectionType == 'music') {
url = '#!/music.html?topParentId=' + item.Id;
url = '#/music.html?topParentId=' + item.Id;
if (options?.section === 'latest') {
url += '&tab=1';
@ -668,24 +672,24 @@ class AppRouter {
const itemTypes = ['Playlist', 'TvChannel', 'Program', 'BoxSet', 'MusicAlbum', 'MusicGenre', 'Person', 'Recording', 'MusicArtist'];
if (itemTypes.indexOf(itemType) >= 0) {
return '#!/details?id=' + id + '&serverId=' + serverId;
return '#/details?id=' + id + '&serverId=' + serverId;
}
const contextSuffix = context ? '&context=' + context : '';
if (itemType == 'Series' || itemType == 'Season' || itemType == 'Episode') {
return '#!/details?id=' + id + contextSuffix + '&serverId=' + serverId;
return '#/details?id=' + id + contextSuffix + '&serverId=' + serverId;
}
if (item.IsFolder) {
if (id) {
return '#!/list.html?parentId=' + id + '&serverId=' + serverId;
return '#/list.html?parentId=' + id + '&serverId=' + serverId;
}
return '#';
}
return '#!/details?id=' + id + '&serverId=' + serverId;
return '#/details?id=' + id + '&serverId=' + serverId;
}
showLocalLogin(serverId) {