diff options
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/packages/desktop/src/renderer/app.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gui/packages/desktop/src/renderer/app.js b/gui/packages/desktop/src/renderer/app.js index a0529d6390..6a806f0e6b 100644 --- a/gui/packages/desktop/src/renderer/app.js +++ b/gui/packages/desktop/src/renderer/app.js @@ -348,6 +348,8 @@ export default class AppRenderer { // set the appropriate start view await this._setStartView(); + // try to autoconnect the tunnel + await this._autoConnect(); } _onDaemonDisconnected(error: ?Error) { @@ -411,6 +413,25 @@ export default class AppRenderer { } } + async _autoConnect() { + const accountToken = this._settings.accountToken; + + if (accountToken) { + if (process.env.NODE_ENV !== 'development') { + try { + log.debug('Autoconnect the tunnel'); + await this.connectTunnel(); + } catch (error) { + log.error(`Failed to autoconnect the tunnel: ${error.message}`); + } + } else { + log.debug('Skip autoconnect in development'); + } + } else { + log.debug('Skip autoconnect because account token is not set'); + } + } + _setTunnelState(tunnelState: TunnelStateTransition) { const actions = this._reduxActions; |
