diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2021-11-26 14:19:08 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2022-03-14 13:58:44 +0100 |
| commit | ebfdf9289aff8d85266161b17f490bc0a661ffcf (patch) | |
| tree | 07cd905c535564dfc3b35a63856ec21359aad658 /gui/src/main | |
| parent | 9916f3444c1d15a6d9ad5caba3555e1c0e1a704c (diff) | |
| download | mullvadvpn-ebfdf9289aff8d85266161b17f490bc0a661ffcf.tar.xz mullvadvpn-ebfdf9289aff8d85266161b17f490bc0a661ffcf.zip | |
Add log out confirmation dialog
Diffstat (limited to 'gui/src/main')
| -rw-r--r-- | gui/src/main/daemon-rpc.ts | 16 | ||||
| -rw-r--r-- | gui/src/main/index.ts | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index bb90d77d52..ff0c81a707 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -516,7 +516,7 @@ export class DaemonRpc { accountToken, ); - return response.toObject().devicesList; + return response.getDevicesList().map(convertFromDevice); } public async removeDevice(deviceRemoval: IDeviceRemoval): Promise<void> { @@ -1376,16 +1376,26 @@ function convertFromDeviceEvent(deviceEvent: grpcTypes.DeviceEvent): IDeviceEven } function convertFromDeviceConfig(deviceConfig?: grpcTypes.DeviceConfig): DeviceConfig { + const device = deviceConfig?.getDevice(); return ( deviceConfig && { accountToken: deviceConfig.getAccountToken(), - device: deviceConfig.getDevice()?.toObject(), + device: device ? convertFromDevice(device) : undefined, } ); } function convertFromDeviceRemoval(deviceRemoval: grpcTypes.RemoveDeviceEvent): Array<IDevice> { - return deviceRemoval.getNewDeviceListList().map((device) => device.toObject()); + return deviceRemoval.getNewDeviceListList().map(convertFromDevice); +} + +function convertFromDevice(device: grpcTypes.Device): IDevice { + const asObject = device.toObject(); + + return { + ...asObject, + ports: asObject.portsList.map((port) => port.id), + }; } function ensureExists<T>(value: T | undefined, errorMessage: string): T { diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts index 9bb988a199..b1f7f44b8a 100644 --- a/gui/src/main/index.ts +++ b/gui/src/main/index.ts @@ -1312,6 +1312,10 @@ class ApplicationMain { }); IpcMainEventChannel.account.handleUpdateData(() => this.updateAccountData()); + IpcMainEventChannel.account.handleGetDevice(async () => { + const deviceConfig = await this.daemonRpc.getDevice(); + return deviceConfig?.device; + }); IpcMainEventChannel.account.handleListDevices((accountToken: AccountToken) => { return this.daemonRpc.listDevices(accountToken); }); |
