summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-12-09 13:52:48 +0100
committerOskar Nyberg <oskar@mullvad.net>2020-12-09 13:52:48 +0100
commitae3cae40c16b01683b2a562ac48799699c711ca2 (patch)
tree88b3aae528c977fe0a86f4a2f8974668dced84d8 /gui/src/main
parent83bdea1ba486c2625e99625e1948730359d01d22 (diff)
parentd53403ee74a89643c3f3ff201128b32fc760798f (diff)
downloadmullvadvpn-ae3cae40c16b01683b2a562ac48799699c711ca2.tar.xz
mullvadvpn-ae3cae40c16b01683b2a562ac48799699c711ca2.zip
Merge branch 'improve-ipc'
Diffstat (limited to 'gui/src/main')
-rw-r--r--gui/src/main/index.ts31
-rw-r--r--gui/src/main/window-controller.ts6
2 files changed, 17 insertions, 20 deletions
diff --git a/gui/src/main/index.ts b/gui/src/main/index.ts
index 15e119559a..36744104b5 100644
--- a/gui/src/main/index.ts
+++ b/gui/src/main/index.ts
@@ -632,7 +632,10 @@ class ApplicationMain {
private setWireguardKey(wireguardKey?: IWireguardPublicKey) {
this.wireguardPublicKey = wireguardKey;
if (this.windowController) {
- IpcMainEventChannel.wireguardKeys.notify(this.windowController.webContents, wireguardKey);
+ IpcMainEventChannel.wireguardKeys.notifyPublicKey(
+ this.windowController.webContents,
+ wireguardKey,
+ );
}
if (wireguardKey) {
@@ -981,19 +984,19 @@ class ApplicationMain {
wireguardPublicKey: this.wireguardPublicKey,
}));
- IpcMainEventChannel.settings.handleAllowLan((allowLan: boolean) =>
+ IpcMainEventChannel.settings.handleSetAllowLan((allowLan: boolean) =>
this.daemonRpc.setAllowLan(allowLan),
);
- IpcMainEventChannel.settings.handleShowBetaReleases((showBetaReleases: boolean) =>
+ IpcMainEventChannel.settings.handleSetShowBetaReleases((showBetaReleases: boolean) =>
this.daemonRpc.setShowBetaReleases(showBetaReleases),
);
- IpcMainEventChannel.settings.handleEnableIpv6((enableIpv6: boolean) =>
+ IpcMainEventChannel.settings.handleSetEnableIpv6((enableIpv6: boolean) =>
this.daemonRpc.setEnableIpv6(enableIpv6),
);
- IpcMainEventChannel.settings.handleBlockWhenDisconnected((blockWhenDisconnected: boolean) =>
+ IpcMainEventChannel.settings.handleSetBlockWhenDisconnected((blockWhenDisconnected: boolean) =>
this.daemonRpc.setBlockWhenDisconnected(blockWhenDisconnected),
);
- IpcMainEventChannel.settings.handleBridgeState(async (bridgeState: BridgeState) => {
+ IpcMainEventChannel.settings.handleSetBridgeState(async (bridgeState: BridgeState) => {
await this.daemonRpc.setBridgeState(bridgeState);
// Reset bridge constraints to `any` when the state is set to auto or off
@@ -1001,10 +1004,10 @@ class ApplicationMain {
await this.daemonRpc.setBridgeSettings(new BridgeSettingsBuilder().location.any().build());
}
});
- IpcMainEventChannel.settings.handleOpenVpnMssfix((mssfix?: number) =>
+ IpcMainEventChannel.settings.handleSetOpenVpnMssfix((mssfix?: number) =>
this.daemonRpc.setOpenVpnMssfix(mssfix),
);
- IpcMainEventChannel.settings.handleWireguardMtu((mtu?: number) =>
+ IpcMainEventChannel.settings.handleSetWireguardMtu((mtu?: number) =>
this.daemonRpc.setWireguardMtu(mtu),
);
IpcMainEventChannel.settings.handleUpdateRelaySettings((update: RelaySettingsUpdate) =>
@@ -1013,7 +1016,7 @@ class ApplicationMain {
IpcMainEventChannel.settings.handleUpdateBridgeSettings((bridgeSettings: BridgeSettings) => {
return this.daemonRpc.setBridgeSettings(bridgeSettings);
});
- IpcMainEventChannel.settings.handleDnsOptions((dns: IDnsOptions) => {
+ IpcMainEventChannel.settings.handleSetDnsOptions((dns: IDnsOptions) => {
return this.daemonRpc.setDnsOptions(dns);
});
IpcMainEventChannel.autoStart.handleSet((autoStart: boolean) => {
@@ -1024,19 +1027,19 @@ class ApplicationMain {
IpcMainEventChannel.tunnel.handleDisconnect(() => this.daemonRpc.disconnectTunnel());
IpcMainEventChannel.tunnel.handleReconnect(() => this.daemonRpc.reconnectTunnel());
- IpcMainEventChannel.guiSettings.handleEnableSystemNotifications((flag: boolean) => {
+ IpcMainEventChannel.guiSettings.handleSetEnableSystemNotifications((flag: boolean) => {
this.guiSettings.enableSystemNotifications = flag;
});
- IpcMainEventChannel.guiSettings.handleAutoConnect((autoConnect: boolean) => {
+ IpcMainEventChannel.guiSettings.handleSetAutoConnect((autoConnect: boolean) => {
this.guiSettings.autoConnect = autoConnect;
});
- IpcMainEventChannel.guiSettings.handleStartMinimized((startMinimized: boolean) => {
+ IpcMainEventChannel.guiSettings.handleSetStartMinimized((startMinimized: boolean) => {
this.guiSettings.startMinimized = startMinimized;
});
- IpcMainEventChannel.guiSettings.handleMonochromaticIcon((monochromaticIcon: boolean) => {
+ IpcMainEventChannel.guiSettings.handleSetMonochromaticIcon((monochromaticIcon: boolean) => {
this.guiSettings.monochromaticIcon = monochromaticIcon;
});
@@ -1052,7 +1055,7 @@ class ApplicationMain {
IpcMainEventChannel.account.handleCreate(() => this.createNewAccount());
IpcMainEventChannel.account.handleLogin((token: AccountToken) => this.login(token));
IpcMainEventChannel.account.handleLogout(() => this.logout());
- IpcMainEventChannel.account.handleWwwAuthToken(() => this.daemonRpc.getWwwAuthToken());
+ IpcMainEventChannel.account.handleGetWwwAuthToken(() => this.daemonRpc.getWwwAuthToken());
IpcMainEventChannel.account.handleSubmitVoucher((voucherCode: string) =>
this.daemonRpc.submitVoucher(voucherCode),
);
diff --git a/gui/src/main/window-controller.ts b/gui/src/main/window-controller.ts
index 09b8d7651f..a44724d23f 100644
--- a/gui/src/main/window-controller.ts
+++ b/gui/src/main/window-controller.ts
@@ -199,12 +199,6 @@ export default class WindowController {
return this.windowValue.isVisible();
}
- // Electron uses the `any` type.
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- public send(event: string, ...data: any[]): void {
- this.webContentsValue.send(event, ...data);
- }
-
private showImmediately() {
const window = this.windowValue;