diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-11-20 13:46:26 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2017-11-23 12:41:13 +0100 |
| commit | 36a84eca50eea4d5ff21fef829c675965d0114c3 (patch) | |
| tree | 6d481728ac1dd67fd1412d2816d2575b5d26f520 | |
| parent | 5cbb22d21196a3dcef75455fda7dd686c1dfd001 (diff) | |
| download | mullvadvpn-36a84eca50eea4d5ff21fef829c675965d0114c3.tar.xz mullvadvpn-36a84eca50eea4d5ff21fef829c675965d0114c3.zip | |
Add custom endpoint handling in syncRelaySettings
| -rw-r--r-- | app/lib/backend.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js index 105af65fd0..17144339da 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -8,7 +8,6 @@ import accountActions from '../redux/account/actions'; import connectionActions from '../redux/connection/actions'; import settingsActions from '../redux/settings/actions'; import { push } from 'react-router-redux'; -import { defaultServer } from '../config'; import type { ReduxStore } from '../redux/store'; import type { AccountToken, BackendState, RelaySettingsUpdate } from './ipc-facade'; @@ -318,16 +317,19 @@ export class Backend { .then( constraints => { log.debug('Got constraints from backend', constraints); - const host = constraints.host === 'any' - ? defaultServer - : constraints.host.only || defaultServer; + const { custom_tunnel_endpoint, normal } = constraints; - const openvpn = constraints.tunnel.openvpn; - this._store.dispatch(settingsActions.updateRelay({ - host: host, - port: this._apiToReduxConstraints(openvpn.port), - protocol: this._apiToReduxConstraints(openvpn.protocol), - })); + if(normal) { + // TODO: handle normal constraints + log.warn('syncRelaySettings: Normal constraints are not implemented yet.'); + } else if(custom_tunnel_endpoint) { + const { host, tunnel: { openvpn } } = custom_tunnel_endpoint; + this._store.dispatch(settingsActions.updateRelay({ + host: host, + port: openvpn.port, + protocol: openvpn.protocol, + })); + } }) .catch( e => { log.error('Failed getting relay constraints', e); |
