Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

DesktopIpcHandlers.ts

86 lines2.6 KB

1import * as Effect from "effect/Effect";
2​
3import * as DesktopIpc from "./DesktopIpc.ts";
4import { getClientSettings, setClientSettings } from "./methods/clientSettings.ts";
5import {
6 clearConnectionCatalog,
7 getConnectionCatalog,
8 setConnectionCatalog,
9} from "./methods/connectionCatalog.ts";
10import {
11 getAdvertisedEndpoints,
12 getServerExposureState,
13 setServerExposureMode,
14 setTailscaleServeEnabled,
15} from "./methods/serverExposure.ts";
16import {
17 bootstrapSshBearerSession,
18 disconnectSshEnvironment,
19 discoverSshHosts,
20 ensureSshEnvironment,
21 fetchSshEnvironmentDescriptor,
22 fetchSshSessionState,
23 issueSshWebSocketTicket,
24 resolveSshPasswordPrompt,
25} from "./methods/sshEnvironment.ts";
26import {
27 checkForUpdate,
28 downloadUpdate,
29 getUpdateState,
30 installUpdate,
31 setUpdateChannel,
32} from "./methods/updates.ts";
33import {
34 confirm,
35 getAppBranding,
36 getLocalEnvironmentBearerToken,
37 getLocalEnvironmentBootstrap,
38 openExternal,
39 pickFolder,
40 setTheme,
41 showContextMenu,
42} from "./methods/window.ts";
43import * as PreviewIpc from "./methods/preview.ts";
44​
45export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
46 const ipc = yield* DesktopIpc.DesktopIpc;
47 yield* PreviewIpc.installPreviewEventForwarding();
48​
49 yield* ipc.handleSync(getAppBranding);
50 yield* ipc.handleSync(getLocalEnvironmentBootstrap);
51 yield* ipc.handle(getLocalEnvironmentBearerToken);
52​
53 yield* ipc.handle(getClientSettings);
54 yield* ipc.handle(setClientSettings);
55 yield* ipc.handle(getConnectionCatalog);
56 yield* ipc.handle(setConnectionCatalog);
57 yield* ipc.handle(clearConnectionCatalog);
58​
59 yield* ipc.handle(discoverSshHosts);
60 yield* ipc.handle(ensureSshEnvironment);
61 yield* ipc.handle(disconnectSshEnvironment);
62 yield* ipc.handle(fetchSshEnvironmentDescriptor);
63 yield* ipc.handle(bootstrapSshBearerSession);
64 yield* ipc.handle(fetchSshSessionState);
65 yield* ipc.handle(issueSshWebSocketTicket);
66 yield* ipc.handle(resolveSshPasswordPrompt);
67​
68 yield* ipc.handle(getServerExposureState);
69 yield* ipc.handle(setServerExposureMode);
70 yield* ipc.handle(setTailscaleServeEnabled);
71 yield* ipc.handle(getAdvertisedEndpoints);
72​
73 yield* ipc.handle(pickFolder);
74 yield* ipc.handle(confirm);
75 yield* ipc.handle(setTheme);
76 yield* ipc.handle(showContextMenu);
77 yield* ipc.handle(openExternal);
78 yield* ipc.handle(getUpdateState);
79 yield* ipc.handle(setUpdateChannel);
80 yield* ipc.handle(downloadUpdate);
81 yield* ipc.handle(installUpdate);
82 yield* ipc.handle(checkForUpdate);
83 for (const previewMethod of PreviewIpc.methods) {
84 yield* ipc.handle(previewMethod);
85 }
86});