summaryrefslogtreecommitdiffhomepage
path: root/gui/src/shared
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2020-07-20 22:25:00 +0200
committerOskar Nyberg <oskar@mullvad.net>2020-08-14 12:32:08 +0200
commit50e5c00f7c045b9517e6302face111ae477d16b9 (patch)
treeb992307c7e7c3150434f44d281fdb753f9b3bf15 /gui/src/shared
parenta43de9a29a1f5a130d4d7ff081dac8cf37a9a876 (diff)
downloadmullvadvpn-50e5c00f7c045b9517e6302face111ae477d16b9.tar.xz
mullvadvpn-50e5c00f7c045b9517e6302face111ae477d16b9.zip
Add function for retrieving installed applications on Linux
Diffstat (limited to 'gui/src/shared')
-rw-r--r--gui/src/shared/ipc-event-channel.ts26
-rw-r--r--gui/src/shared/linux-split-tunneling-application.ts6
2 files changed, 32 insertions, 0 deletions
diff --git a/gui/src/shared/ipc-event-channel.ts b/gui/src/shared/ipc-event-channel.ts
index b020808e76..3c4cd55cfb 100644
--- a/gui/src/shared/ipc-event-channel.ts
+++ b/gui/src/shared/ipc-event-channel.ts
@@ -6,6 +6,7 @@ import { IGuiSettingsState } from './gui-settings-state';
import { ICurrentAppVersionInfo } from '../main/index';
import { IWindowShapeParameters } from '../main/window-controller';
+import ISplitTunnelingApplication from '../shared/linux-split-tunneling-application';
import {
AccountToken,
BridgeSettings,
@@ -151,6 +152,18 @@ interface IWireguardKeyHandlers extends ISender<IWireguardPublicKey | undefined>
handleVerifyKey(fn: () => Promise<boolean>): void;
}
+interface ISplitTunnelingMethods {
+ getApplications(): Promise<ISplitTunnelingApplication[]>;
+ launchApplication(application: ISplitTunnelingApplication | string): Promise<void>;
+}
+
+interface ISplitTunnelingHandlers {
+ handleGetApplications(fn: () => Promise<ISplitTunnelingApplication[]>): void;
+ handleLaunchApplication(
+ fn: (application: ISplitTunnelingApplication | string) => Promise<void>,
+ ): void;
+}
+
/// Events names
const LOCALE_CHANGED = 'locale-changed';
@@ -207,6 +220,9 @@ const WIREGUARD_KEYGEN_EVENT = 'wireguard-keygen-event';
const GENERATE_WIREGUARD_KEY = 'generate-wireguard-key';
const VERIFY_WIREGUARD_KEY = 'verify-wireguard-key';
+const SPLIT_TUNNELING_GET_APPLICATIONS = 'split-tunneling-get-applications';
+const SPLIT_TUNNELING_LAUNCH_APPLICATION = 'split-tunneling-launch-application';
+
/// Typed IPC event channel
///
/// Static methods are meant to be provide the way to send the events from a renderer process, while
@@ -306,6 +322,11 @@ export class IpcRendererEventChannel {
generateKey: requestSender(GENERATE_WIREGUARD_KEY),
verifyKey: requestSender(VERIFY_WIREGUARD_KEY),
};
+
+ public static splitTunneling: ISplitTunnelingMethods = {
+ getApplications: requestSender(SPLIT_TUNNELING_GET_APPLICATIONS),
+ launchApplication: requestSender(SPLIT_TUNNELING_LAUNCH_APPLICATION),
+ };
}
export class IpcMainEventChannel {
@@ -403,6 +424,11 @@ export class IpcMainEventChannel {
handleGenerateKey: requestHandler(GENERATE_WIREGUARD_KEY),
handleVerifyKey: requestHandler(VERIFY_WIREGUARD_KEY),
};
+
+ public static splitTunneling: ISplitTunnelingHandlers = {
+ handleGetApplications: requestHandler(SPLIT_TUNNELING_GET_APPLICATIONS),
+ handleLaunchApplication: requestHandler(SPLIT_TUNNELING_LAUNCH_APPLICATION),
+ };
}
function listen<T>(event: string): (fn: (value: T) => void) => void {
diff --git a/gui/src/shared/linux-split-tunneling-application.ts b/gui/src/shared/linux-split-tunneling-application.ts
new file mode 100644
index 0000000000..f75406b301
--- /dev/null
+++ b/gui/src/shared/linux-split-tunneling-application.ts
@@ -0,0 +1,6 @@
+export default interface ISplitTunnelingApplication {
+ absolutepath: string;
+ name: string;
+ exec: string;
+ icon?: string;
+}