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

Merge pull request #3688 from thornbill/no-hash-bang

Remove hash bang paths
This commit is contained in:
Bill Thornton 2022-06-14 10:39:09 -04:00 committed by GitHub
commit 6d3365bc09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {

View file

@ -9,7 +9,7 @@ const createLinkElement = ({ user, renderImgUrl }: { user: UserDto, renderImgUrl
__html: `<a
is="emby-linkbutton"
class="cardContent"
href="#!/useredit.html?userId=${user.Id}"
href="#/useredit.html?userId=${user.Id}"
>
${renderImgUrl}
</a>`

View file

@ -148,7 +148,7 @@ import '../elements/emby-itemscontainer/emby-itemscontainer';
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
if (!layoutManager.tv && options.Limit && result.Items.length >= options.Limit) {
html += '<a is="emby-linkbutton" href="' + ('#!/list.html?serverId=' + ApiClient.serverId() + '&type=' + section.types + '&IsFavorite=true') + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
html += '<a is="emby-linkbutton" href="' + ('#/list.html?serverId=' + ApiClient.serverId() + '&type=' + section.types + '&IsFavorite=true') + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
html += '<h2 class="sectionTitle sectionTitle-cards">';
html += globalize.translate(section.name);
html += '</h2>';

View file

@ -147,7 +147,7 @@ function updateNowPlayingInfo(context, state, serverId) {
for (const artist of item.ArtistItems) {
const artistName = escapeHtml(artist.Name);
const artistId = artist.Id;
artistsSeries += `<a class="button-link emby-button" is="emby-linkbutton" href="#!/details?id=${artistId}&serverId=${nowPlayingServerId}">${escapeHtml(artistName)}</a>`;
artistsSeries += `<a class="button-link emby-button" is="emby-linkbutton" href="#/details?id=${artistId}&serverId=${nowPlayingServerId}">${escapeHtml(artistName)}</a>`;
if (artist !== item.ArtistItems.slice(-1)[0]) {
artistsSeries += ', ';
}
@ -165,7 +165,7 @@ function updateNowPlayingInfo(context, state, serverId) {
}
}
if (item.Album != null) {
albumName = '<a class="button-link emby-button" is="emby-linkbutton" href="#!/details?id=' + item.AlbumId + `&serverId=${nowPlayingServerId}">` + escapeHtml(item.Album) + '</a>';
albumName = '<a class="button-link emby-button" is="emby-linkbutton" href="#/details?id=' + item.AlbumId + `&serverId=${nowPlayingServerId}">` + escapeHtml(item.Album) + '</a>';
}
context.querySelector('.nowPlayingAlbum').innerHTML = albumName;
context.querySelector('.nowPlayingArtist').innerHTML = artistsSeries;
@ -173,12 +173,12 @@ function updateNowPlayingInfo(context, state, serverId) {
} else if (item.Type == 'Episode') {
if (item.SeasonName != null) {
const seasonName = item.SeasonName;
context.querySelector('.nowPlayingSeason').innerHTML = '<a class="button-link emby-button" is="emby-linkbutton" href="#!/details?id=' + item.SeasonId + `&serverId=${nowPlayingServerId}">${escapeHtml(seasonName)}</a>`;
context.querySelector('.nowPlayingSeason').innerHTML = '<a class="button-link emby-button" is="emby-linkbutton" href="#/details?id=' + item.SeasonId + `&serverId=${nowPlayingServerId}">${escapeHtml(seasonName)}</a>`;
}
if (item.SeriesName != null) {
const seriesName = item.SeriesName;
if (item.SeriesId != null) {
context.querySelector('.nowPlayingSerie').innerHTML = '<a class="button-link emby-button" is="emby-linkbutton" href="#!/details?id=' + item.SeriesId + `&serverId=${nowPlayingServerId}">${escapeHtml(seriesName)}</a>`;
context.querySelector('.nowPlayingSerie').innerHTML = '<a class="button-link emby-button" is="emby-linkbutton" href="#/details?id=' + item.SeriesId + `&serverId=${nowPlayingServerId}">${escapeHtml(seriesName)}</a>`;
} else {
context.querySelector('.nowPlayingSerie').innerText = seriesName;
}