diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-11-26 10:04:11 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-11-26 10:04:11 +0100 |
| commit | f99e235ae18e9c71a6381bd10d9d2a1d0bea0f19 (patch) | |
| tree | 0c05132cfdb5cda55cc6226a547c0b000cf73b05 /gui/src/main | |
| parent | 581a487b6012ea753137a1d9d3cc343d15de684d (diff) | |
| parent | 963ad808e25f7439656554878fcebc146be20f77 (diff) | |
| download | mullvadvpn-f99e235ae18e9c71a6381bd10d9d2a1d0bea0f19.tar.xz mullvadvpn-f99e235ae18e9c71a6381bd10d9d2a1d0bea0f19.zip | |
Merge branch 'upgrade-to-electron-11'
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/index.ts | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 7f693e2fdf..73a1656782 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -1,5 +1,15 @@ import { execFile } from 'child_process'; -import { app, BrowserWindow, ipcMain, Menu, nativeImage, screen, shell, Tray } from 'electron'; +import { + app, + BrowserWindow, + ipcMain, + Menu, + nativeImage, + screen, + session, + shell, + Tray, +} from 'electron'; import log from 'electron-log'; import mkdirp from 'mkdirp'; import moment from 'moment'; @@ -213,10 +223,6 @@ class ApplicationMain { this.guiSettings.load(); - // The default value has previously been false but will be changed to true in Electron 9. The - // false value has been deprecated in Electron 8. This can be removed when Electron 9 is used. - app.allowRendererProcessReuse = true; - app.on('activate', this.onActivate); app.on('ready', this.onReady); app.on('window-all-closed', () => app.quit()); @@ -345,6 +351,11 @@ class ApplicationMain { } private onReady = async () => { + // There's no option that prevents Electron from fetching spellcheck dictionaries from + // Chromium's CDN and passing a non-resolving URL is the only known way to prevent it from + // fetching. https://github.com/electron/electron/issues/22995 + session.defaultSession.setSpellCheckerDictionaryDownloadURL('https://00.00/'); + this.updateCurrentLocale(); this.daemonRpc.addConnectionObserver( @@ -423,7 +434,13 @@ class ApplicationMain { const filePath = path.resolve(path.join(__dirname, '../renderer/index.html')); try { - await this.windowController?.window.loadFile(filePath); + if (process.env.NODE_ENV === 'development') { + await this.windowController?.window.loadURL( + 'http://localhost:8080/src/renderer/index.html', + ); + } else { + await this.windowController?.window.loadFile(filePath); + } } catch (error) { log.error(`Failed to load index file: ${error.message}`); } @@ -1397,6 +1414,9 @@ class ApplicationMain { webPreferences: { nodeIntegration: true, devTools: process.env.NODE_ENV === 'development', + // TODO: Remove use of remote + enableRemoteModule: true, + spellcheck: false, }, }; |
