Merge pull request #469 from yuya-oc/remove-secure-contents-only
Remove "Display secure content only" option
This commit is contained in:
commit
0e61fd526f
|
@ -11,6 +11,7 @@ from the final changelog of the release.
|
||||||
Release date: TBD
|
Release date: TBD
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
- Removed "Display secure content only" option it's no longer necessary.
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ const styles = {
|
||||||
|
|
||||||
const MainPage = React.createClass({
|
const MainPage = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
disablewebsecurity: React.PropTypes.bool.isRequired,
|
|
||||||
onUnreadCountChange: React.PropTypes.func.isRequired,
|
onUnreadCountChange: React.PropTypes.func.isRequired,
|
||||||
teams: React.PropTypes.array.isRequired,
|
teams: React.PropTypes.array.isRequired,
|
||||||
onTeamConfigChange: React.PropTypes.func.isRequired,
|
onTeamConfigChange: React.PropTypes.func.isRequired,
|
||||||
|
@ -291,7 +290,6 @@ const MainPage = React.createClass({
|
||||||
style={self.visibleStyle(isActive)}
|
style={self.visibleStyle(isActive)}
|
||||||
src={team.url}
|
src={team.url}
|
||||||
name={team.name}
|
name={team.name}
|
||||||
disablewebsecurity={this.props.disablewebsecurity}
|
|
||||||
onTargetURLChange={self.handleTargetURLChange}
|
onTargetURLChange={self.handleTargetURLChange}
|
||||||
onUnreadCountChange={handleUnreadCountChange}
|
onUnreadCountChange={handleUnreadCountChange}
|
||||||
onNotificationClick={handleNotificationClick}
|
onNotificationClick={handleNotificationClick}
|
||||||
|
|
|
@ -12,7 +12,6 @@ const preloadJS = `file://${remote.app.getAppPath()}/browser/webview/mattermost_
|
||||||
|
|
||||||
const MattermostView = React.createClass({
|
const MattermostView = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
disablewebsecurity: React.PropTypes.bool,
|
|
||||||
name: React.PropTypes.string,
|
name: React.PropTypes.string,
|
||||||
id: React.PropTypes.string,
|
id: React.PropTypes.string,
|
||||||
onTargetURLChange: React.PropTypes.func,
|
onTargetURLChange: React.PropTypes.func,
|
||||||
|
@ -38,12 +37,6 @@ const MattermostView = React.createClass({
|
||||||
var self = this;
|
var self = this;
|
||||||
var webview = findDOMNode(this.refs.webview);
|
var webview = findDOMNode(this.refs.webview);
|
||||||
|
|
||||||
// This option allows insecure content, when set to true it is possible to
|
|
||||||
// load content via HTTP while the mattermost server serves HTTPS
|
|
||||||
if (this.props.disablewebsecurity === true) {
|
|
||||||
webview.setAttribute('webpreferences', 'allowDisplayingInsecureContent');
|
|
||||||
}
|
|
||||||
|
|
||||||
webview.addEventListener('did-fail-load', (e) => {
|
webview.addEventListener('did-fail-load', (e) => {
|
||||||
console.log(self.props.name, 'webview did-fail-load', e);
|
console.log(self.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).
|
||||||
|
@ -218,10 +211,6 @@ const MattermostView = React.createClass({
|
||||||
errorInfo={this.state.errorInfo}
|
errorInfo={this.state.errorInfo}
|
||||||
/>) : null;
|
/>) : null;
|
||||||
|
|
||||||
// 'disablewebsecurity' is necessary to display external images.
|
|
||||||
// However, it allows also CSS/JavaScript.
|
|
||||||
// So webview should use 'allowDisplayingInsecureContent' as same as BrowserWindow.
|
|
||||||
|
|
||||||
// Need to keep webview mounted when failed to load.
|
// Need to keep webview mounted when failed to load.
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -107,7 +107,6 @@ const SettingsPage = React.createClass({
|
||||||
teams: this.state.teams,
|
teams: this.state.teams,
|
||||||
showTrayIcon: this.state.showTrayIcon,
|
showTrayIcon: this.state.showTrayIcon,
|
||||||
trayIconTheme: this.state.trayIconTheme,
|
trayIconTheme: this.state.trayIconTheme,
|
||||||
disablewebsecurity: this.state.disablewebsecurity,
|
|
||||||
version: settings.version,
|
version: settings.version,
|
||||||
minimizeToTray: this.state.minimizeToTray,
|
minimizeToTray: this.state.minimizeToTray,
|
||||||
notifications: {
|
notifications: {
|
||||||
|
@ -151,12 +150,6 @@ const SettingsPage = React.createClass({
|
||||||
handleCancel() {
|
handleCancel() {
|
||||||
backToIndex();
|
backToIndex();
|
||||||
},
|
},
|
||||||
handleChangeDisableWebSecurity() {
|
|
||||||
this.setState({
|
|
||||||
disablewebsecurity: this.refs.disablewebsecurity.props.checked
|
|
||||||
});
|
|
||||||
setImmediate(this.startSaveConfig);
|
|
||||||
},
|
|
||||||
handleChangeShowTrayIcon() {
|
handleChangeShowTrayIcon() {
|
||||||
var shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
|
var shouldShowTrayIcon = !this.refs.showTrayIcon.props.checked;
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -272,21 +265,6 @@ const SettingsPage = React.createClass({
|
||||||
</Checkbox>);
|
</Checkbox>);
|
||||||
}
|
}
|
||||||
|
|
||||||
options.push(
|
|
||||||
<Checkbox
|
|
||||||
key='inputDisableWebSecurity'
|
|
||||||
id='inputDisableWebSecurity'
|
|
||||||
ref='disablewebsecurity'
|
|
||||||
checked={!this.state.disablewebsecurity}
|
|
||||||
onChange={this.handleChangeDisableWebSecurity}
|
|
||||||
>{'Display secure content only'}
|
|
||||||
<HelpBlock>
|
|
||||||
{'If enabled, the app only displays secure (HTTPS/SSL) content.'}
|
|
||||||
{' '}
|
|
||||||
{'If disabled, the app displays secure and non-secure (HTTP) content such as images.'}
|
|
||||||
</HelpBlock>
|
|
||||||
</Checkbox>);
|
|
||||||
|
|
||||||
if (process.platform === 'darwin' || process.platform === 'win32') {
|
if (process.platform === 'darwin' || process.platform === 'win32') {
|
||||||
const TASKBAR = process.platform === 'win32' ? 'taskbar' : 'Dock';
|
const TASKBAR = process.platform === 'win32' ? 'taskbar' : 'Dock';
|
||||||
options.push(
|
options.push(
|
||||||
|
|
|
@ -95,7 +95,6 @@ const initialIndex = parsedURL.query.index ? parseInt(parsedURL.query.index, 10)
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<MainPage
|
<MainPage
|
||||||
disablewebsecurity={AppConfig.data.disablewebsecurity}
|
|
||||||
teams={AppConfig.data.teams}
|
teams={AppConfig.data.teams}
|
||||||
initialIndex={initialIndex}
|
initialIndex={initialIndex}
|
||||||
onUnreadCountChange={showUnreadBadge}
|
onUnreadCountChange={showUnreadBadge}
|
||||||
|
|
|
@ -18,7 +18,6 @@ function loadDefault(version) {
|
||||||
teams: [],
|
teams: [],
|
||||||
showTrayIcon: false,
|
showTrayIcon: false,
|
||||||
trayIconTheme: 'light',
|
trayIconTheme: 'light',
|
||||||
disablewebsecurity: true,
|
|
||||||
minimizeToTray: false,
|
minimizeToTray: false,
|
||||||
version: 1,
|
version: 1,
|
||||||
notifications: {
|
notifications: {
|
||||||
|
|
|
@ -119,49 +119,6 @@ describe('browser/settings.html', function desc() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Display secure content only', () => {
|
|
||||||
[true, false].forEach((v) => {
|
|
||||||
it(`should be saved and loaded: ${v}`, () => {
|
|
||||||
const webPreferences = v ? '' : 'allowDisplayingInsecureContent';
|
|
||||||
env.addClientCommands(this.app.client);
|
|
||||||
|
|
||||||
return this.app.client.
|
|
||||||
loadSettingsPage().
|
|
||||||
scroll('#inputDisableWebSecurity').
|
|
||||||
isSelected('#inputDisableWebSecurity').then((isSelected) => {
|
|
||||||
if (isSelected !== v) {
|
|
||||||
return this.app.client.click('#inputDisableWebSecurity');
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}).
|
|
||||||
pause(600).
|
|
||||||
click('#btnClose').
|
|
||||||
pause(1000).then(() => {
|
|
||||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
|
||||||
savedConfig.disablewebsecurity.should.equal(!v);
|
|
||||||
}).
|
|
||||||
getAttribute('.mattermostView', 'webpreferences').then((disablewebsecurity) => { // confirm actual behavior
|
|
||||||
// disablewebsecurity is an array of String
|
|
||||||
disablewebsecurity.forEach((d) => {
|
|
||||||
d.should.equal(webPreferences);
|
|
||||||
});
|
|
||||||
}).then(() => {
|
|
||||||
return this.app.restart();
|
|
||||||
}).then(() => {
|
|
||||||
env.addClientCommands(this.app.client);
|
|
||||||
return this.app.client. // confirm actual behavior
|
|
||||||
getAttribute('.mattermostView', 'webpreferences').then((disablewebsecurity) => { // disablewebsecurity is an array of String
|
|
||||||
disablewebsecurity.forEach((d) => {
|
|
||||||
d.should.equal(webPreferences);
|
|
||||||
});
|
|
||||||
}).
|
|
||||||
loadSettingsPage().
|
|
||||||
isSelected('#inputDisableWebSecurity').should.eventually.equal(v);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Start app on login', () => {
|
describe('Start app on login', () => {
|
||||||
it('should appear on win32 or linux', () => {
|
it('should appear on win32 or linux', () => {
|
||||||
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
const expected = (process.platform === 'win32' || process.platform === 'linux');
|
||||||
|
|
Loading…
Reference in a new issue