URI handling and encoding

This commit is contained in:
James Barnsley
2019-01-17 15:54:04 +13:00
parent d5c946456f
commit 9144a194e1
6 changed files with 1950 additions and 1980 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1547579515";
var build = "1547667440";
var version = "3.31.8";
// Construct the script tag

View File

@ -411,8 +411,8 @@ class App extends React.Component{
<Route exact path="/library/albums" component={LibraryAlbums} />
<Route exact path="/library/tracks" component={LibraryTracks} />
<Route exact path="/library/playlists" component={LibraryPlaylists} />
<Route exact path="/library/browse/:uri" component={LibraryBrowseDirectory} />
<Route exact path="/library/browse" component={LibraryBrowse} />
<Route exact path="/library/browse/:uri" component={LibraryBrowseDirectory} />
<Route>
<h1>I'm lost</h1>

View File

@ -26,11 +26,11 @@ class LibraryBrowse extends React.Component{
}
componentDidMount(){
this.loadDirectory()
this.loadDirectory();
this.props.uiActions.setWindowTitle("Browse");
}
componentWillReceiveProps(nextProps){
this.props.uiActions.setWindowTitle("Browse");
// mopidy goes online
if (!this.props.mopidy_connected && nextProps.mopidy_connected){
@ -40,11 +40,7 @@ class LibraryBrowse extends React.Component{
loadDirectory(props = this.props){
if (props.mopidy_connected){
var uri = null
if (props.uri !== undefined){
uri = props.uri;
}
this.props.mopidyActions.getDirectory(uri);
this.props.mopidyActions.getDirectory(null);
}
}
@ -120,7 +116,8 @@ class LibraryBrowse extends React.Component{
<GridItem
item={item}
key={index}
type="category"
link={item.link}
type="browse"
/>
)
}

View File

@ -41,7 +41,7 @@ class LibraryBrowseDirectory extends React.Component{
console.log(nextProps.uri,this.props.uri);
//this.loadDirectory(nextProps);
this.loadDirectory(nextProps);
}
}
@ -119,10 +119,11 @@ class LibraryBrowseDirectory extends React.Component{
<div className="grid category-grid">
{
subdirectories.map(subdirectory => {
return (
return (
<GridItem
key={subdirectory.uri}
type="directory"
type="browse"
link={global.baseURL+'library/browse/'+encodeURIComponent(subdirectory.uri)}
item={subdirectory}
/>
);