Fix regression introduced by hash fixes in Media Manager.

This commit is contained in:
Buster Neece 2022-11-07 17:43:45 -06:00
parent 4407289880
commit d4566c5d71
No known key found for this signature in database
GPG Key ID: F1D2E64A0005E80E
1 changed files with 21 additions and 4 deletions

View File

@ -292,7 +292,6 @@ export default {
files: [],
directories: []
},
currentDirectory: '',
searchPhrase: null
};
@ -302,13 +301,19 @@ export default {
let urlHash = decodeURIComponent(window.location.hash.substring(1).replace(/\+/g, '%20'));
if ('' !== urlHash) {
if (urlHash.substring(0, 9) === 'playlist:' || urlHash.substring(0, 8) === 'special:') {
window.location.hash = '';
this.filter(urlHash);
if (this.isFilterString(urlHash)) {
this.$nextTick(() => {
this.onHashChange();
});
} else {
this.currentDirectory = urlHash;
}
}
window.addEventListener('hashchange', this.onHashChange);
},
destroyed() {
window.removeEventListener('hashchange', this.onHashChange);
},
computed: {
langAlbumArt() {
@ -350,6 +355,18 @@ export default {
onAddPlaylist(row) {
this.playlists.push(row);
},
onHashChange() {
// Handle links from the sidebar for special functions.
let urlHash = decodeURIComponent(window.location.hash.substr(1).replace(/\+/g, '%20'));
if ('' !== urlHash && this.isFilterString(urlHash)) {
window.location.hash = '';
this.filter(urlHash);
}
},
isFilterString(str) {
return str.substring(0, 9) === 'playlist:' || str.substring(0, 8) === 'special:';
},
playAudio(url) {
this.$eventHub.$emit('player_toggle', url);
},