User-defined SSL settings; Git.io hosted app

This commit is contained in:
James Barnsley
2017-11-27 16:38:33 +13:00
parent 34acda244f
commit f1408290ae
12 changed files with 102 additions and 28 deletions

View File

@ -13,7 +13,7 @@ from core import IrisCore
from raven import Client
logger = logging.getLogger(__name__)
__version__ = '3.8.5'
__version__ = '3.8.6'
##
# Core extension class

View File

@ -48838,6 +48838,7 @@ var initialState = {
connected: false,
host: window.location.hostname,
port: window.location.port ? window.location.port : window.location.protocol === 'https:' ? '443' : '80',
ssl: window.location.protocol === 'https:' ? true : false,
mute: false,
volume: 0,
progress: 0,
@ -49461,9 +49462,9 @@ function reducer() {
case 'MOPIDY_SET_CONFIG':
return Object.assign({}, mopidy, {
host: action.host,
port: action.port,
ssl: action.ssl
host: action.config.host,
port: action.config.port,
ssl: action.config.ssl
});
case 'MOPIDY_CHANGE_TRACK':
@ -51471,7 +51472,7 @@ var MopidyMiddleware = function () {
var state = store.getState();
socket = new _mopidy2.default({
webSocketUrl: 'ws' + (window.location.protocol === 'https:' ? 's' : '') + '://' + state.mopidy.host + ':' + state.mopidy.port + '/mopidy/ws/',
webSocketUrl: 'ws' + (state.mopidy.ssl ? 's' : '') + '://' + state.mopidy.host + ':' + state.mopidy.port + '/mopidy/ws/',
callingConvention: 'by-position-or-by-name'
});
@ -56194,7 +56195,8 @@ var localstorageMiddleware = function () {
case 'MOPIDY_SET_CONFIG':
helpers.setStorage('mopidy', {
host: action.config.host,
port: action.config.port
port: action.config.port,
ssl: action.config.ssl
});
break;
@ -64893,6 +64895,7 @@ var Settings = function (_React$Component) {
locale: _this.props.core.locale,
mopidy_host: _this.props.mopidy.host,
mopidy_port: _this.props.mopidy.port,
mopidy_ssl: _this.props.mopidy.ssl,
pusher_username: _this.props.pusher.username,
input_in_focus: null
};
@ -64940,11 +64943,17 @@ var Settings = function (_React$Component) {
return false;
}
}, {
key: 'setMopidyConfig',
value: function setMopidyConfig(e) {
key: 'setConfig',
value: function setConfig(e) {
this.setState({ input_in_focus: null });
e.preventDefault();
this.props.mopidyActions.setConfig({ host: this.state.mopidy_host, port: this.state.mopidy_port });
this.props.mopidyActions.setConfig({
host: this.state.mopidy_host,
port: this.state.mopidy_port,
ssl: this.state.mopidy_ssl
});
window.location.reload(true);
return false;
}
@ -64970,7 +64979,9 @@ var Settings = function (_React$Component) {
}, {
key: 'renderApplyButton',
value: function renderApplyButton() {
if (this.props.mopidy.host == this.state.mopidy_host && this.props.mopidy.port == this.state.mopidy_port) return null;
if (this.props.mopidy.host == this.state.mopidy_host && this.props.mopidy.port == this.state.mopidy_port && this.props.mopidy.ssl == this.state.mopidy_ssl) {
return null;
}
return _react2.default.createElement(
'div',
@ -65227,7 +65238,7 @@ var Settings = function (_React$Component) {
_react2.default.createElement(
'form',
{ onSubmit: function onSubmit(e) {
return _this3.setMopidyConfig(e);
return _this3.setConfig(e);
} },
_react2.default.createElement(
'div',
@ -65279,6 +65290,40 @@ var Settings = function (_React$Component) {
value: this.state.mopidy_port })
)
),
_react2.default.createElement(
'div',
{ className: 'field checkbox' },
_react2.default.createElement(
'div',
{ className: 'name' },
'Encryption'
),
_react2.default.createElement(
'div',
{ className: 'input' },
_react2.default.createElement(
'label',
null,
_react2.default.createElement('input', {
type: 'checkbox',
name: 'ssl',
checked: this.state.mopidy_ssl,
onChange: function onChange(e) {
return _this3.setState({ mopidy_ssl: !_this3.state.mopidy_ssl });
} }),
_react2.default.createElement(
'span',
{ className: 'label has-tooltip' },
'Enable SSL',
_react2.default.createElement(
'span',
{ className: 'tooltip' },
'Requires SSL proxy'
)
)
)
)
),
this.renderApplyButton()
),
_react2.default.createElement(

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,8 +38,8 @@
// Release details
// These are automatically injected to built HTML
var build = "1511724955";
var version = "3.8.5";
var build = "1511753865";
var version = "3.8.6";
// Construct the script tag
var js = document.createElement("script");

View File

@ -1,6 +1,6 @@
{
"name": "mopidy-iris",
"version": "3.8.5",
"version": "3.8.6",
"description": "Mopidy HTTP interface",
"repository": "https://github.com/jaedb/iris",
"author": "James Barnsley <james@barnsley.nz>",

1
src/js/bootstrap.js vendored
View File

@ -53,6 +53,7 @@ var initialState = {
connected: false,
host: window.location.hostname,
port: (window.location.port ? window.location.port : (window.location.protocol === 'https:' ? '443' : '80')),
ssl: (window.location.protocol === 'https:' ? true : false),
mute: false,
volume: 0,
progress: 0,

View File

@ -63,7 +63,8 @@ const localstorageMiddleware = (function(){
'mopidy',
{
host: action.config.host,
port: action.config.port
port: action.config.port,
ssl: action.config.ssl
}
);
break;

View File

@ -205,7 +205,7 @@ const MopidyMiddleware = (function(){
var state = store.getState()
socket = new Mopidy({
webSocketUrl: 'ws'+(window.location.protocol === 'https:' ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/mopidy/ws/',
webSocketUrl: 'ws'+(state.mopidy.ssl ? 's' : '')+'://'+state.mopidy.host+':'+state.mopidy.port+'/mopidy/ws/',
callingConvention: 'by-position-or-by-name'
})

View File

@ -16,9 +16,9 @@ export default function reducer(mopidy = {}, action){
case 'MOPIDY_SET_CONFIG':
return Object.assign({}, mopidy, {
host: action.host,
port: action.port,
ssl: action.ssl
host: action.config.host,
port: action.config.port,
ssl: action.config.ssl
});
case 'MOPIDY_CHANGE_TRACK':

View File

@ -33,6 +33,7 @@ class Settings extends React.Component {
locale: this.props.core.locale,
mopidy_host: this.props.mopidy.host,
mopidy_port: this.props.mopidy.port,
mopidy_ssl: this.props.mopidy.ssl,
pusher_username: this.props.pusher.username,
input_in_focus: null
}
@ -75,10 +76,16 @@ class Settings extends React.Component {
return false;
}
setMopidyConfig(e){
this.setState({input_in_focus: null})
setConfig(e){
this.setState({input_in_focus: null});
e.preventDefault();
this.props.mopidyActions.setConfig({ host: this.state.mopidy_host, port: this.state.mopidy_port });
this.props.mopidyActions.setConfig({
host: this.state.mopidy_host,
port: this.state.mopidy_port,
ssl: this.state.mopidy_ssl
});
window.location.reload(true);
return false;
}
@ -100,7 +107,11 @@ class Settings extends React.Component {
}
renderApplyButton(){
if (this.props.mopidy.host == this.state.mopidy_host && this.props.mopidy.port == this.state.mopidy_port) return null
if (this.props.mopidy.host == this.state.mopidy_host &&
this.props.mopidy.port == this.state.mopidy_port &&
this.props.mopidy.ssl == this.state.mopidy_ssl){
return null;
}
return (
<div className="field">
@ -280,7 +291,7 @@ class Settings extends React.Component {
</div>
</div>
<form onSubmit={(e) => this.setMopidyConfig(e)}>
<form onSubmit={(e) => this.setConfig(e)}>
<div className="field">
<div className="name">Host</div>
<div className="input">
@ -303,6 +314,22 @@ class Settings extends React.Component {
value={ this.state.mopidy_port } />
</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 has-tooltip">
Enable SSL
<span className="tooltip">Requires SSL proxy</span>
</span>
</label>
</div>
</div>
{this.renderApplyButton()}
</form>