diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-01-11 15:44:50 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-01-15 16:21:31 +0100 |
| commit | 928615a5a91ef4a3f52fbd4a6629e86993a1a3aa (patch) | |
| tree | d76821ad40b0d72f359051945b2d5c415c99fca2 /app/lib/ipc-facade.js | |
| parent | fc4178d7e3329fb1fd0014e4ce349a79eafeca51 (diff) | |
| download | mullvadvpn-928615a5a91ef4a3f52fbd4a6629e86993a1a3aa.tar.xz mullvadvpn-928615a5a91ef4a3f52fbd4a6629e86993a1a3aa.zip | |
Adapt frontend to removed ip call and changed location struct
Diffstat (limited to 'app/lib/ipc-facade.js')
| -rw-r--r-- | app/lib/ipc-facade.js | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/app/lib/ipc-facade.js b/app/lib/ipc-facade.js index b2676193ee..b54cbe5177 100644 --- a/app/lib/ipc-facade.js +++ b/app/lib/ipc-facade.js @@ -4,22 +4,24 @@ import JsonRpcWs, { InvalidReply } from './jsonrpc-ws-ipc'; import { object, string, number, boolean, enumeration, arrayOf, oneOf } from 'validated/schema'; import { validate } from 'validated/object'; -import type { Coordinate2d } from '../types'; - export type AccountData = { expiry: string }; export type AccountToken = string; export type Ip = string; export type Location = { + ip: Ip, country: string, city: string, - position: Coordinate2d, + latitude: number, + longitude: number, + mullvad_exit_ip: boolean, }; const LocationSchema = object({ + ip: string, country: string, - country_code: string, city: string, - city_code: string, - position: arrayOf(number), + latitude: number, + longitude: number, + mullvad_exit_ip: boolean, }); export type SecurityState = 'secured' | 'unsecured'; @@ -121,7 +123,8 @@ export type RelayListCountry = { export type RelayListCity = { name: string, code: string, - position: [number, number], + latitude: number, + longitude: number, has_active_relays: boolean, }; @@ -132,7 +135,8 @@ const RelayListSchema = object({ cities: arrayOf(object({ name: string, code: string, - position: arrayOf(number), + latitude: number, + longitude: number, has_active_relays: boolean, })), })), @@ -152,7 +156,6 @@ export interface IpcFacade { connect(): Promise<void>, disconnect(): Promise<void>, shutdown(): Promise<void>, - getPublicIp(): Promise<Ip>, getLocation(): Promise<Location>, getState(): Promise<BackendState>, registerStateListener((BackendState) => void): void, @@ -264,17 +267,6 @@ export class RealIpc implements IpcFacade { .then(this._ignoreResponse); } - getPublicIp(): Promise<Ip> { - return this._ipc.send('get_public_ip') - .then(raw => { - if (typeof raw === 'string' && raw) { - return raw; - } else { - throw new InvalidReply(raw, 'Expected a string'); - } - }); - } - getLocation(): Promise<Location> { return this._ipc.send('get_current_location') .then(raw => { |
