Merge branch 'experiment/disablewebsecurity' into dev

This commit is contained in:
Yuya Ochiai
2016-04-19 20:32:20 +09:00
5 changed files with 23 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
## Release v1.2.0 (Beta) ## Release v1.2.0 (Beta)
### Improvements ### Improvements
- Add **Allow insecure contents** option to render images with `http://`.
#### OS X #### OS X
- Add the option to show the icon on menu bar - Add the option to show the icon on menu bar
@@ -67,7 +68,6 @@ The `electron-mattermost` project is now the official desktop application for th
### Known issues ### Known issues
#### All platforms #### All platforms
- Images with `http://` do not render.
- Basic Authentication is not working. - Basic Authentication is not working.
- Some keyboard shortcuts are missing. (e.g. <kbd>Ctrl+W</kbd>, <kbd>Command+,</kbd>) - Some keyboard shortcuts are missing. (e.g. <kbd>Ctrl+W</kbd>, <kbd>Command+,</kbd>)
- Basic authentication requires a command line. - Basic authentication requires a command line.

View File

@@ -48,8 +48,12 @@ The Settings Page is available from the **File** menu under **Settings** (Click
2. Enter **URL** for the team site location. For example: `https://example.com/teamname` then click **Add**. 2. Enter **URL** for the team site location. For example: `https://example.com/teamname` then click **Add**.
- **Delete a Team Site**: - **Delete a Team Site**:
1. Delete a Team Site by clicking the "x" next to the URL of the team site you wish to delete. 1. Delete a Team Site by clicking the "x" next to the URL of the team site you wish to delete.
- **Hide Menu Bar** - **Options**
1. Under **Options** enable this option to hide the menu bar by default. Press "Alt" to show the Menu Bar. - **Hide Menu Bar**
1. Under **Options** enable this option to hide the menu bar by default. Press "Alt" to show the Menu Bar.
- **Allow insecure contents**
1. Your team is hosted on `https://`, images with `http://` are not rendered by default.
This option allows such images to be rendered, but please be careful for security.
### Menu Bar ### Menu Bar

View File

@@ -256,6 +256,12 @@ var MattermostView = React.createClass({
var thisObj = this; var thisObj = this;
var webview = ReactDOM.findDOMNode(this.refs.webview); var webview = ReactDOM.findDOMNode(this.refs.webview);
// This option disables the same-origin policy and allows js/css/plugins not only content like images.
if (config.disablewebsecurity === true) {
// webview.setAttribute('disablewebsecurity', false) disables websecurity. (electron's bug?)
webview.setAttribute('disablewebsecurity', true);
}
webview.addEventListener('did-fail-load', function(e) { webview.addEventListener('did-fail-load', function(e) {
console.log(thisObj.props.name, 'webview did-fail-load', e); console.log(thisObj.props.name, 'webview did-fail-load', e);
if (e.errorCode === -3) { // An operation was aborted (due to user action). if (e.errorCode === -3) { // An operation was aborted (due to user action).

View File

@@ -28,11 +28,7 @@ var SettingsPage = React.createClass({
} catch (e) { } catch (e) {
config = settings.loadDefault(); config = settings.loadDefault();
} }
return { return config;
teams: config.teams,
hideMenuBar: config.hideMenuBar,
showTrayIcon: config.showTrayIcon
};
}, },
handleTeamsChange: function(teams) { handleTeamsChange: function(teams) {
this.setState({ this.setState({
@@ -44,6 +40,7 @@ var SettingsPage = React.createClass({
teams: this.state.teams, teams: this.state.teams,
hideMenuBar: this.state.hideMenuBar, hideMenuBar: this.state.hideMenuBar,
showTrayIcon: this.state.showTrayIcon, showTrayIcon: this.state.showTrayIcon,
disablewebsecurity: this.state.disablewebsecurity,
version: settings.version version: settings.version
}; };
settings.writeFileSync(this.props.configFile, config); settings.writeFileSync(this.props.configFile, config);
@@ -57,6 +54,11 @@ var SettingsPage = React.createClass({
handleCancel: function() { handleCancel: function() {
backToIndex(); backToIndex();
}, },
handleChangeDisableWebSecurity: function() {
this.setState({
disablewebsecurity: this.refs.disablewebsecurity.getChecked()
});
},
handleChangeHideMenuBar: function() { handleChangeHideMenuBar: function() {
this.setState({ this.setState({
hideMenuBar: this.refs.hideMenuBar.getChecked() hideMenuBar: this.refs.hideMenuBar.getChecked()
@@ -85,6 +87,8 @@ var SettingsPage = React.createClass({
options.push(<Input ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon } onChange={ this.handleChangeShowTrayIcon } options.push(<Input ref="showTrayIcon" type="checkbox" label="Show Icon on Menu Bar (Need to restart the application)" checked={ this.state.showTrayIcon } onChange={ this.handleChangeShowTrayIcon }
/>); />);
} }
options.push(<Input ref="disablewebsecurity" type="checkbox" label="Allow insecure contents (This allows not only insecure images, but also insecure scripts)" checked={ this.state.disablewebsecurity }
onChange={ this.handleChangeDisableWebSecurity } />);
var options_row = (options.length > 0) ? ( var options_row = (options.length > 0) ? (
<Row> <Row>
<Col md={ 12 }> <Col md={ 12 }>

View File

@@ -24,6 +24,7 @@ var loadDefault = function(version) {
teams: [], teams: [],
hideMenuBar: false, hideMenuBar: false,
showTrayIcon: false, showTrayIcon: false,
disablewebsecurity: false,
version: 1 version: 1
}; };
} }