diff options
Diffstat (limited to 'gui/src/shared')
| -rw-r--r-- | gui/src/shared/ipc-event-channel.ts | 26 | ||||
| -rw-r--r-- | gui/src/shared/linux-split-tunneling-application.ts | 6 |
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; +} |
