Merge pull request #359 from jnugh/yt
disableWebSecurity -> allowDisplayingInsecureContent
This commit is contained in:
@@ -24,6 +24,7 @@ Release date: TBD
|
|||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
- Fixed wrong cursor for "Edit" and "Remove" in Setting page
|
- Fixed wrong cursor for "Edit" and "Remove" in Setting page
|
||||||
- Fixed an issue where "Zoom in/out" does not properly work
|
- Fixed an issue where "Zoom in/out" does not properly work
|
||||||
|
- YouTube preview works, even if mixed content is allowed
|
||||||
|
|
||||||
#### Windows
|
#### Windows
|
||||||
- The accelerator of "Redo" is now shown as `Ctrl+Y`
|
- The accelerator of "Redo" is now shown as `Ctrl+Y`
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
"chai-as-promised": "^5.3.0",
|
"chai-as-promised": "^5.3.0",
|
||||||
"cross-env": "^3.1.2",
|
"cross-env": "^3.1.2",
|
||||||
"devtron": "^1.3.0",
|
"devtron": "^1.3.0",
|
||||||
"electron": "1.4.2",
|
"electron": "1.4.6",
|
||||||
"electron-builder": "^7.11.2",
|
"electron-builder": "^7.11.2",
|
||||||
"electron-connect": "~0.6.0",
|
"electron-connect": "~0.6.0",
|
||||||
"eslint": "^3.4.0",
|
"eslint": "^3.4.0",
|
||||||
|
@@ -392,10 +392,10 @@ var MattermostView = React.createClass({
|
|||||||
var self = this;
|
var self = 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.
|
// This option allows insecure content, when set to true it is possible to
|
||||||
|
// load content via HTTP while the mattermost server serves HTTPS
|
||||||
if (config.disablewebsecurity === true) {
|
if (config.disablewebsecurity === true) {
|
||||||
// webview.setAttribute('disablewebsecurity', false) disables websecurity. (electron's bug?)
|
webview.setAttribute('webpreferences', 'allowDisplayingInsecureContent');
|
||||||
webview.setAttribute('disablewebsecurity', true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
webview.addEventListener('did-fail-load', (e) => {
|
webview.addEventListener('did-fail-load', (e) => {
|
||||||
|
@@ -92,7 +92,9 @@ describe('browser/settings.html', function desc() {
|
|||||||
describe('Allow mixed content', () => {
|
describe('Allow mixed content', () => {
|
||||||
[true, false].forEach((v) => {
|
[true, false].forEach((v) => {
|
||||||
it(`should be saved and loaded: ${v}`, () => {
|
it(`should be saved and loaded: ${v}`, () => {
|
||||||
|
const webPreferences = v ? 'allowDisplayingInsecureContent' : '';
|
||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
|
|
||||||
return this.app.client.
|
return this.app.client.
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
scroll('#inputDisableWebSecurity').
|
scroll('#inputDisableWebSecurity').
|
||||||
@@ -107,19 +109,19 @@ describe('browser/settings.html', function desc() {
|
|||||||
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
const savedConfig = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
savedConfig.disablewebsecurity.should.equal(v);
|
savedConfig.disablewebsecurity.should.equal(v);
|
||||||
}).
|
}).
|
||||||
getAttribute('.mattermostView', 'disablewebsecurity').then((disablewebsecurity) => { // confirm actual behavior
|
getAttribute('.mattermostView', 'webpreferences').then((disablewebsecurity) => { // confirm actual behavior
|
||||||
// disablewebsecurity is an array of String
|
// disablewebsecurity is an array of String
|
||||||
disablewebsecurity.forEach((d) => {
|
disablewebsecurity.forEach((d) => {
|
||||||
v.toString().should.equal(d);
|
d.should.equal(webPreferences);
|
||||||
});
|
});
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
return this.app.restart();
|
return this.app.restart();
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
env.addClientCommands(this.app.client);
|
env.addClientCommands(this.app.client);
|
||||||
return this.app.client. // confirm actual behavior
|
return this.app.client. // confirm actual behavior
|
||||||
getAttribute('.mattermostView', 'disablewebsecurity').then((disablewebsecurity) => { // disablewebsecurity is an array of String
|
getAttribute('.mattermostView', 'webpreferences').then((disablewebsecurity) => { // disablewebsecurity is an array of String
|
||||||
disablewebsecurity.forEach((d) => {
|
disablewebsecurity.forEach((d) => {
|
||||||
v.toString().should.equal(d);
|
d.should.equal(webPreferences);
|
||||||
});
|
});
|
||||||
}).
|
}).
|
||||||
loadSettingsPage().
|
loadSettingsPage().
|
||||||
|
Reference in New Issue
Block a user