Browse Source

Don't open external links in the Electron context

patch-1
Luke Childs 7 years ago
committed by GitHub
parent
commit
fe40a4bcfe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      react/src/components/dashboard/support/support.js

20
react/src/components/dashboard/support/support.js

@ -1,5 +1,6 @@
import React from 'react'; import React from 'react';
import { translate } from '../../../translate/translate'; import { translate } from '../../../translate/translate';
import electron from 'electron';
class Support extends React.Component { class Support extends React.Component {
constructor() { constructor() {
@ -7,22 +8,7 @@ class Support extends React.Component {
} }
openExternalWindow(url) { openExternalWindow(url) {
const remote = window.require('electron').remote; return electron.shell.openExternal(url);
const BrowserWindow = remote.BrowserWindow;
const externalWindow = new BrowserWindow({
width: 1280,
height: 800,
title: `${translate('INDEX.LOADING')}...`,
icon: remote.getCurrentWindow().iguanaIcon,
});
externalWindow.loadURL(url);
externalWindow.webContents.on('did-finish-load', () => {
setTimeout(() => {
externalWindow.show();
}, 40);
});
} }
render() { render() {
@ -94,4 +80,4 @@ class Support extends React.Component {
} }
} }
export default Support; export default Support;

Loading…
Cancel
Save