aboutsummaryrefslogtreecommitdiffstats
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/index.js b/src/index.js
index 9146a23da..d2b0f56f4 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,6 +1,6 @@
1/* eslint-disable import/first */ 1/* eslint-disable import/first */
2 2
3import { app, BrowserWindow, shell, ipcMain, session } from 'electron'; 3import { app, BrowserWindow, ipcMain, session } from 'electron';
4 4
5import { emptyDirSync, ensureFileSync } from 'fs-extra'; 5import { emptyDirSync, ensureFileSync } from 'fs-extra';
6import { join } from 'path'; 6import { join } from 'path';
@@ -34,7 +34,7 @@ import { appId } from './package.json'; // eslint-disable-line import/no-unresol
34import './electron/exception'; 34import './electron/exception';
35 35
36import { asarPath } from './helpers/asar-helpers'; 36import { asarPath } from './helpers/asar-helpers';
37import { isValidExternalURL } from './helpers/url-helpers'; 37import { openExternalUrl } from './helpers/url-helpers';
38import userAgent from './helpers/userAgent-helpers'; 38import userAgent from './helpers/userAgent-helpers';
39 39
40const debug = require('debug')('Ferdi:App'); 40const debug = require('debug')('Ferdi:App');
@@ -342,12 +342,8 @@ const createWindow = () => {
342 app.isMaximized = mainWindow.isMaximized(); 342 app.isMaximized = mainWindow.isMaximized();
343 343
344 mainWindow.webContents.on('new-window', (e, url) => { 344 mainWindow.webContents.on('new-window', (e, url) => {
345 debug('Open url', url);
346 e.preventDefault(); 345 e.preventDefault();
347 346 openExternalUrl(url);
348 if (isValidExternalURL(url)) {
349 shell.openExternal(url);
350 }
351 }); 347 });
352 348
353 if (settings.get('startMinimized')) { 349 if (settings.get('startMinimized')) {
@@ -392,10 +388,9 @@ app.on('ready', () => {
392 enforceMacOSAppLocation(); 388 enforceMacOSAppLocation();
393 389
394 // Register App URL 390 // Register App URL
395 if (isDevMode) { 391 const protocolClient = isDevMode ? 'ferdi-dev' : 'ferdi';
396 app.setAsDefaultProtocolClient('ferdi-dev'); 392 if (!app.isDefaultProtocolClient(protocolClient)) {
397 } else { 393 app.setAsDefaultProtocolClient(protocolClient);
398 app.setAsDefaultProtocolClient('ferdi');
399 } 394 }
400 395
401 if (isWindows) { 396 if (isWindows) {
@@ -455,7 +450,12 @@ ipcMain.on('open-browser-window', (e, { url, serviceId }) => {
455 const serviceSession = session.fromPartition(`persist:service-${serviceId}`); 450 const serviceSession = session.fromPartition(`persist:service-${serviceId}`);
456 const child = new BrowserWindow({ 451 const child = new BrowserWindow({
457 parent: mainWindow, 452 parent: mainWindow,
458 webPreferences: { session: serviceSession }, 453 webPreferences: {
454 session: serviceSession,
455 // TODO: Aren't these needed here?
456 // contextIsolation: false,
457 // enableRemoteModule: true,
458 },
459 }); 459 });
460 child.show(); 460 child.show();
461 child.loadURL(url); 461 child.loadURL(url);