summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-10-05 16:18:28 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-10-05 16:18:28 +0200
commitf18fefd5e5fc3ac2fa66b5fa667be42e518d9013 (patch)
treea36f5269571820196ac9bbd2d0eff000a97d1a65 /gui
parent3e33f9dcfbdf9ac24ef222a12868798cf9f22cf8 (diff)
parent0bd4165557516d0a21603e524b97d6c2d9689575 (diff)
downloadmullvadvpn-f18fefd5e5fc3ac2fa66b5fa667be42e518d9013.tar.xz
mullvadvpn-f18fefd5e5fc3ac2fa66b5fa667be42e518d9013.zip
Merge branch 'show-hostname-not-ip'
Diffstat (limited to 'gui')
-rw-r--r--gui/packages/desktop/src/renderer/app.js16
-rw-r--r--gui/packages/desktop/src/renderer/components/Connect.js20
-rw-r--r--gui/packages/desktop/src/renderer/components/ConnectStyles.js3
-rw-r--r--gui/packages/desktop/src/renderer/lib/daemon-rpc.js9
-rw-r--r--gui/packages/desktop/src/renderer/redux/connection/actions.js4
5 files changed, 16 insertions, 36 deletions
diff --git a/gui/packages/desktop/src/renderer/app.js b/gui/packages/desktop/src/renderer/app.js
index e973340107..61714cb757 100644
--- a/gui/packages/desktop/src/renderer/app.js
+++ b/gui/packages/desktop/src/renderer/app.js
@@ -333,21 +333,7 @@ export default class AppRenderer {
}
async _fetchLocation() {
- const actions = this._reduxActions;
- const location = await this._daemonRpc.getLocation();
-
- log.info('Got location from daemon');
-
- const locationUpdate = {
- ip: location.ip,
- country: location.country,
- city: location.city,
- latitude: location.latitude,
- longitude: location.longitude,
- mullvadExitIp: location.mullvad_exit_ip,
- };
-
- actions.connection.newLocation(locationUpdate);
+ this._reduxActions.connection.newLocation(await this._daemonRpc.getLocation());
}
async setAllowLan(allowLan: boolean) {
diff --git a/gui/packages/desktop/src/renderer/components/Connect.js b/gui/packages/desktop/src/renderer/components/Connect.js
index 9fc7a7de61..b514d63f15 100644
--- a/gui/packages/desktop/src/renderer/components/Connect.js
+++ b/gui/packages/desktop/src/renderer/components/Connect.js
@@ -3,7 +3,7 @@
import moment from 'moment';
import * as React from 'react';
import { Component, Text, View, Types } from 'reactxp';
-import { Accordion, ClipboardLabel, SecuredLabel, SecuredDisplayStyle } from '@mullvad/components';
+import { Accordion, SecuredLabel, SecuredDisplayStyle } from '@mullvad/components';
import { Layout, Container, Header } from './Layout';
import { SettingsBarButton, Brand } from './HeaderBar';
import BlockingInternetBanner, { BannerTitle, BannerSubtitle } from './BlockingInternetBanner';
@@ -176,7 +176,7 @@ export default class Connect extends Component<Props> {
selectedRelayName={this.props.selectedRelayName}
city={this.props.connection.city}
country={this.props.connection.country}
- ip={this.props.connection.ip}
+ hostname={this.props.connection.hostname}
onConnect={this.props.onConnect}
onDisconnect={this.props.onDisconnect}
onSelectLocation={this.props.onSelectLocation}
@@ -307,7 +307,7 @@ type TunnelControlProps = {
selectedRelayName: string,
city: ?string,
country: ?string,
- ip: ?string,
+ hostname: ?string,
onConnect: () => void,
onDisconnect: () => void,
onSelectLocation: () => void,
@@ -318,13 +318,7 @@ export function TunnelControl(props: TunnelControlProps) {
const Location = ({ children }) => <View style={styles.status_location}>{children}</View>;
const City = () => <Text style={styles.status_location_text}>{props.city}</Text>;
const Country = () => <Text style={styles.status_location_text}>{props.country}</Text>;
- const Ip = () => (
- <ClipboardLabel
- style={styles.status_ipaddress}
- value={props.ip || ''}
- message={'IP copied to clipboard!'}
- />
- );
+ const Hostname = () => <Text style={styles.status_hostname}>{props.hostname || ''}</Text>;
const SwitchLocation = () => {
return (
@@ -378,7 +372,9 @@ export function TunnelControl(props: TunnelControlProps) {
<Secured displayStyle={SecuredDisplayStyle.securing} />
<Location>
<City />
+ <Country />
</Location>
+ <Hostname />
</Body>
<Footer>
<SwitchLocation />
@@ -395,7 +391,7 @@ export function TunnelControl(props: TunnelControlProps) {
<City />
<Country />
</Location>
- <Ip />
+ <Hostname />
</Body>
<Footer>
<SwitchLocation />
@@ -425,7 +421,6 @@ export function TunnelControl(props: TunnelControlProps) {
<Location>
<Country />
</Location>
- <Ip />
</Body>
<Footer>
<SelectedLocation />
@@ -442,7 +437,6 @@ export function TunnelControl(props: TunnelControlProps) {
<Location>
<Country />
</Location>
- <Ip />
</Body>
<Footer>
<SelectedLocation />
diff --git a/gui/packages/desktop/src/renderer/components/ConnectStyles.js b/gui/packages/desktop/src/renderer/components/ConnectStyles.js
index b882afb930..54b784c415 100644
--- a/gui/packages/desktop/src/renderer/components/ConnectStyles.js
+++ b/gui/packages/desktop/src/renderer/components/ConnectStyles.js
@@ -76,11 +76,12 @@ export default {
lineHeight: 22,
marginBottom: 4,
}),
- status_ipaddress: Styles.createTextStyle({
+ status_hostname: Styles.createTextStyle({
fontFamily: 'Open Sans',
fontSize: 16,
fontWeight: '800',
color: colors.white,
+ paddingBottom: 2,
}),
status_location: Styles.createTextStyle({
flexDirection: 'column',
diff --git a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js
index cece79f783..12c1e0a214 100644
--- a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js
+++ b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js
@@ -25,20 +25,20 @@ export type AccountData = { expiry: string };
export type AccountToken = string;
export type Ip = string;
export type Location = {
- ip: Ip,
country: string,
city: ?string,
latitude: number,
longitude: number,
mullvad_exit_ip: boolean,
+ hostname: ?string,
};
const LocationSchema = object({
- ip: string,
country: string,
city: maybe(string),
latitude: number,
longitude: number,
mullvad_exit_ip: boolean,
+ hostname: maybe(string),
});
export type BlockReason =
@@ -207,7 +207,6 @@ const RelayListSchema = object({
object({
hostname: string,
ipv4_addr_in: string,
- ipv4_addr_exit: string,
include_in_country: boolean,
weight: number,
}),
@@ -454,7 +453,7 @@ export class DaemonRpc implements DaemonRpcProtocol {
async getLocation(): Promise<Location> {
const response = await this._transport.send('get_current_location', [], NETWORK_CALL_TIMEOUT);
try {
- return validate(LocationSchema, response);
+ return camelCaseObjectKeys(validate(LocationSchema, response));
} catch (error) {
throw new ResponseParseError('Invalid response from get_current_location', error);
}
@@ -463,7 +462,7 @@ export class DaemonRpc implements DaemonRpcProtocol {
async getState(): Promise<TunnelStateTransition> {
const response = await this._transport.send('get_state');
try {
- return validate(TunnelStateTransitionSchema, response);
+ return camelCaseObjectKeys(validate(TunnelStateTransitionSchema, response));
} catch (error) {
throw new ResponseParseError('Invalid response from get_state', error);
}
diff --git a/gui/packages/desktop/src/renderer/redux/connection/actions.js b/gui/packages/desktop/src/renderer/redux/connection/actions.js
index 5b4793f1cc..668eb2a67b 100644
--- a/gui/packages/desktop/src/renderer/redux/connection/actions.js
+++ b/gui/packages/desktop/src/renderer/redux/connection/actions.js
@@ -1,6 +1,6 @@
// @flow
-import type { AfterDisconnect, BlockReason, Ip } from '../../lib/daemon-rpc';
+import type { AfterDisconnect, BlockReason } from '../../lib/daemon-rpc';
type ConnectingAction = {
type: 'CONNECTING',
@@ -27,12 +27,12 @@ type BlockedAction = {
type NewLocationAction = {
type: 'NEW_LOCATION',
newLocation: {
- ip: Ip,
country: string,
city: ?string,
latitude: number,
longitude: number,
mullvadExitIp: boolean,
+ hostname: ?string,
},
};