Removing SSL config - non HTTPS can't use SSL anyway

This commit is contained in:
James Barnsley
2018-10-04 21:07:25 +13:00
parent 5d827902e4
commit 62fe788395
9 changed files with 14100 additions and 10787 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

@ -89,12 +89,29 @@ class App extends React.Component{
// Check for url-parsed configuration values // Check for url-parsed configuration values
var url_vars = this.props.location.query; var url_vars = this.props.location.query;
if (url_vars !== undefined && url_vars.host !== undefined && url_vars.port !== undefined){ if (url_vars){
this.props.mopidyActions.set({ var has_values = false;
host: url_vars.host, var values = {};
port: url_vars.port if (url_vars.host !== undefined){
}); has_values = true;
values.host = url_vars.host;
}
if (url_vars.port !== undefined){
has_values = true;
values.port = url_vars.port;
}
if (has_values){
this.props.mopidyActions.set(values);
// Allow 100ms for the action above to complete before we re-route
setTimeout(
() => {
hashHistory.push(global.baseURL); hashHistory.push(global.baseURL);
},
100
);
}
} }
// show initial setup if required // show initial setup if required

View File

@ -207,13 +207,15 @@ const MopidyMiddleware = (function(){
switch(action.type){ switch(action.type){
case 'MOPIDY_CONNECT': case 'MOPIDY_CONNECT':
if (socket != null){
socket.close();
}
if (socket != null) socket.close();
store.dispatch({ type: 'MOPIDY_CONNECTING'}); store.dispatch({ type: 'MOPIDY_CONNECTING'});
var state = store.getState(); var state = store.getState();
socket = new Mopidy({ socket = new Mopidy({
webSocketUrl: 'ws'+(state.mopidy.ssl ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/mopidy/ws/', webSocketUrl: 'ws'+(window.location.protocol === 'https:' ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/mopidy/ws/',
callingConvention: 'by-position-or-by-name' callingConvention: 'by-position-or-by-name'
}); });

View File

@ -171,8 +171,6 @@ const PusherMiddleware = (function(){
switch(action.type){ switch(action.type){
case 'PUSHER_CONNECT': case 'PUSHER_CONNECT':
// Stagnant socket, close it first
if (socket != null){ if (socket != null){
socket.close(); socket.close();
} }

View File

@ -28,7 +28,6 @@ class Settings extends React.Component {
this.state = { this.state = {
mopidy_host: this.props.mopidy.host, mopidy_host: this.props.mopidy.host,
mopidy_port: this.props.mopidy.port, mopidy_port: this.props.mopidy.port,
mopidy_ssl: this.props.mopidy.ssl,
mopidy_library_artists_uri: this.props.mopidy.library_artists_uri, mopidy_library_artists_uri: this.props.mopidy.library_artists_uri,
mopidy_library_albums_uri: this.props.mopidy.library_albums_uri, mopidy_library_albums_uri: this.props.mopidy.library_albums_uri,
pusher_username: this.props.pusher.username, pusher_username: this.props.pusher.username,
@ -67,8 +66,7 @@ class Settings extends React.Component {
this.props.mopidyActions.set({ this.props.mopidyActions.set({
host: this.state.mopidy_host, host: this.state.mopidy_host,
port: this.state.mopidy_port, port: this.state.mopidy_port
ssl: this.state.mopidy_ssl
}); });
window.location.reload(true); window.location.reload(true);
@ -103,8 +101,7 @@ class Settings extends React.Component {
renderApplyButton(){ renderApplyButton(){
if (this.props.mopidy.host == this.state.mopidy_host && if (this.props.mopidy.host == this.state.mopidy_host &&
this.props.mopidy.port == this.state.mopidy_port && this.props.mopidy.port == this.state.mopidy_port){
this.props.mopidy.ssl == this.state.mopidy_ssl){
return null; return null;
} }
@ -227,22 +224,6 @@ class Settings extends React.Component {
value={ this.state.mopidy_port } /> value={ this.state.mopidy_port } />
</div> </div>
</div> </div>
<div className="field checkbox">
<div className="name">Encryption</div>
<div className="input">
<label>
<input
type="checkbox"
name="ssl"
checked={this.state.mopidy_ssl}
onChange={e => this.setState({mopidy_ssl: !this.state.mopidy_ssl})} />
<span className="label tooltip">
Enable SSL
<span className="tooltip__content">Requires SSL proxy</span>
</span>
</label>
</div>
</div>
{this.renderApplyButton()} {this.renderApplyButton()}
</form> </form>

View File

@ -10,6 +10,8 @@ import TrackList from '../../components/TrackList'
import GridItem from '../../components/GridItem' import GridItem from '../../components/GridItem'
import DropdownField from '../../components/Fields/DropdownField' import DropdownField from '../../components/Fields/DropdownField'
import Icon from '../../components/Icon' import Icon from '../../components/Icon'
import URILink from '../../components/URILink'
import ErrorBoundary from '../../components/ErrorBoundary'
import * as helpers from '../../helpers' import * as helpers from '../../helpers'
import * as uiActions from '../../services/ui/actions' import * as uiActions from '../../services/ui/actions'
@ -63,6 +65,45 @@ class LibraryBrowse extends React.Component{
this.props.uiActions.hideContextMenu(); this.props.uiActions.hideContextMenu();
} }
renderBreadcrumbs(){
if (this.props.params.uri){
var parent_uri = this.props.params.uri;
} else {
return null;
}
if (parent_uri.startsWith('file://')){
var uri = parent_uri.replace('file:///','');
var uri_elements = uri.split('/');
return (
<h4>
{uri_elements.map((uri_element, index) => {
// Reconstruct a URL to this element
var uri = "file://";
for (var i = 0; i <= index; i++){
uri += "/"+uri_elements[i];
}
return (
<span key={uri}>
{index > 0 ? <span>&nbsp; <Icon type="fontawesome" name="angle-right" /> &nbsp;&nbsp;</span> : null}
<URILink type="browse" uri={uri}>
{uri_element}
</URILink>
</span>
);
})}
</h4>
);
}
return null;
}
renderSubdirectories(subdirectories){ renderSubdirectories(subdirectories){
if (this.props.view == 'list'){ if (this.props.view == 'list'){
return ( return (
@ -152,6 +193,9 @@ class LibraryBrowse extends React.Component{
{title} {title}
</Header> </Header>
<section className="content-wrapper"> <section className="content-wrapper">
<ErrorBoundary>
{this.renderBreadcrumbs()}
{subdirectories ? this.renderSubdirectories(subdirectories) : null} {subdirectories ? this.renderSubdirectories(subdirectories) : null}
@ -161,6 +205,7 @@ class LibraryBrowse extends React.Component{
className="library-local-track-list" className="library-local-track-list"
/> : null } /> : null }
</ErrorBoundary>
</section> </section>
</div> </div>
); );
@ -230,6 +275,7 @@ class LibraryBrowse extends React.Component{
</Header> </Header>
<section className="content-wrapper"> <section className="content-wrapper">
<div className="grid category-grid"> <div className="grid category-grid">
<ErrorBoundary>
{ {
grid_items.map( grid_items.map(
(item, index) => { (item, index) => {
@ -244,6 +290,7 @@ class LibraryBrowse extends React.Component{
} }
) )
} }
</ErrorBoundary>
</div> </div>
</section> </section>
</div> </div>

View File

@ -24,8 +24,7 @@ class InitialSetup extends React.Component{
username: this.props.username, username: this.props.username,
allow_reporting: this.props.allow_reporting, allow_reporting: this.props.allow_reporting,
host: this.props.host, host: this.props.host,
port: this.props.port, port: this.props.port
ssl: this.props.ssl
} }
} }
@ -46,8 +45,7 @@ class InitialSetup extends React.Component{
}); });
this.props.mopidyActions.set({ this.props.mopidyActions.set({
host: this.state.host, host: this.state.host,
port: this.state.port, port: this.state.port
ssl: this.state.ssl
}); });
this.setState({saving: true}); this.setState({saving: true});
@ -56,7 +54,7 @@ class InitialSetup extends React.Component{
setTimeout(function(){ setTimeout(function(){
// We've changed a connection setting, so need to reload // We've changed a connection setting, so need to reload
if (self.state.host !== self.props.host || self.state.port !== self.props.port || self.state.ssl !== self.props.ssl){ if (self.state.host !== self.props.host || self.state.port !== self.props.port){
window.location = global.baseURL; window.location = global.baseURL;
@ -108,21 +106,6 @@ class InitialSetup extends React.Component{
value={ this.state.port } /> value={ this.state.port } />
</div> </div>
</div> </div>
<div className="field checkbox">
<div className="input">
<label>
<input
type="checkbox"
name="ssl"
checked={this.state.ssl}
onChange={e => this.setState({ssl: !this.state.ssl})} />
<span className="label tooltip">
Enable SSL
<span className="tooltip__content">Requires SSL proxy</span>
</span>
</label>
</div>
</div>
{helpers.isHosted() ? null : <div className="field checkbox"> {helpers.isHosted() ? null : <div className="field checkbox">
<div className="input"> <div className="input">
@ -157,8 +140,7 @@ const mapStateToProps = (state, ownProps) => {
allow_reporting: state.ui.allow_reporting, allow_reporting: state.ui.allow_reporting,
username: (state.pusher && state.pusher.username ? state.pusher.username : 'Anonymous'), username: (state.pusher && state.pusher.username ? state.pusher.username : 'Anonymous'),
host: state.mopidy.host, host: state.mopidy.host,
port: state.mopidy.port, port: state.mopidy.port
ssl: state.mopidy.ssl
} }
} }