diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-04-19 18:55:31 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-04-23 21:51:59 +0200 |
| commit | 308832d0df052dd4433bda2cc5c586ca9745c249 (patch) | |
| tree | fb923fc7a264149837fe36d442b920bed8874a48 /app | |
| parent | 8f6f61ebd6a013f657a2523dbe4b4cfa1a1cb462 (diff) | |
| download | mullvadvpn-308832d0df052dd4433bda2cc5c586ca9745c249.tar.xz mullvadvpn-308832d0df052dd4433bda2cc5c586ca9745c249.zip | |
Add basic windows service
Diffstat (limited to 'app')
| -rw-r--r-- | app/main.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/main.js b/app/main.js index 0c5eb7ec73..df7f9fbf50 100644 --- a/app/main.js +++ b/app/main.js @@ -41,7 +41,11 @@ const appDelegate = { log.info('Running version', version); - appDelegate._startBackend(); + // Only macOS builds still launch the daemon manually. + // On other platforms mullvad-daemon already runs as a system service. + if (process.platform === 'darwin') { + appDelegate._startBackend(); + } app.on('window-all-closed', () => appDelegate.onAllWindowsClosed()); app.on('ready', () => appDelegate.onReady()); @@ -95,15 +99,18 @@ const appDelegate = { ipcMain.on('hide-window', () => window.hide()); window.loadURL('file://' + path.join(__dirname, 'index.html')); - if (process.platform === 'linux') { + + // Since macOS still runs the daemon manually it has to shut it down. + // On other platforms closing the app only disconnects the tunnel. + if (process.platform === 'darwin') { window.on('close', () => { - log.debug('The browser window is closing, shutting down the tunnel...'); - window.webContents.send('disconnect'); + log.debug('The browser window is closing, shutting down the daemon...'); + window.webContents.send('shutdown'); }); } else { window.on('close', () => { - log.debug('The browser window is closing, shutting down the daemon...'); - window.webContents.send('shutdown'); + log.debug('The browser window is closing, shutting down the tunnel...'); + window.webContents.send('disconnect'); }); } |
