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

DesktopIpcHandlers.ts

138 lines4.4 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 resolveSshHost,
25 resolveSshPasswordPrompt,
26} from "./methods/sshEnvironment.ts";
27import {
28 checkForUpdate,
29 downloadUpdate,
30 getUpdateState,
31 installUpdate,
32 setUpdateChannel,
33} from "./methods/updates.ts";
34import {
35 getAppBranding,
36 getLocalEnvironmentBootstraps,
37 getLocalEnvironmentBearerToken,
38 getSystemLocale,
39 getWindowFullscreenState,
40 openExternal,
41 openSystemSettings,
42 checkSystemPermission,
43 probeRemoteEditors,
44 pickFolder,
45 pickProjectFavicon,
46 pickThemeFiles,
47 setTheme,
48 showContextMenu,
49} from "./methods/window.ts";
50import {
51 acknowledgeSnapShot,
52 checkSnapShotShortcut,
53 dismissSnapShotAnimation,
54 getSnapShotState,
55 setupSnapShot,
56 previewSnapShotConfig,
57 applySnapShotConfig,
58 listPendingSnapShots,
59 readSnapShot,
60 requestSnapShotPermissions,
61 setSnapShotAnimationDestination,
62 setSnapShotShortcutSuppressed,
63} from "./methods/snapShot.ts";
64import * as PreviewIpc from "./methods/preview.ts";
65import * as AppActivationIpc from "./methods/appActivation.ts";
66import { getWslState, setWslBackendEnabled, setWslDistro, setWslOnly } from "./methods/wsl.ts";
67​
68export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
69 const ipc = yield* DesktopIpc.DesktopIpc;
70 yield* PreviewIpc.installPreviewEventForwarding();
71​
72 yield* ipc.handle(AppActivationIpc.setReady);
73 yield* ipc.handle(AppActivationIpc.complete);
74​
75 yield* ipc.handleSync(getAppBranding);
76 yield* ipc.handleSync(getSystemLocale);
77 yield* ipc.handleSync(getWindowFullscreenState);
78 yield* ipc.handleSync(getLocalEnvironmentBootstraps);
79 yield* ipc.handle(getLocalEnvironmentBearerToken);
80​
81 yield* ipc.handle(getClientSettings);
82 yield* ipc.handle(setClientSettings);
83 yield* ipc.handle(getConnectionCatalog);
84 yield* ipc.handle(getSnapShotState);
85 yield* ipc.handle(setupSnapShot);
86 yield* ipc.handle(previewSnapShotConfig);
87 yield* ipc.handle(applySnapShotConfig);
88 yield* ipc.handle(requestSnapShotPermissions);
89 yield* ipc.handle(checkSnapShotShortcut);
90 yield* ipc.handle(setSnapShotShortcutSuppressed);
91 yield* ipc.handle(listPendingSnapShots);
92 yield* ipc.handle(readSnapShot);
93 yield* ipc.handle(setSnapShotAnimationDestination);
94 yield* ipc.handle(dismissSnapShotAnimation);
95 yield* ipc.handle(acknowledgeSnapShot);
96 yield* ipc.handle(setConnectionCatalog);
97 yield* ipc.handle(clearConnectionCatalog);
98​
99 yield* ipc.handle(discoverSshHosts);
100 yield* ipc.handle(resolveSshHost);
101 yield* ipc.handle(ensureSshEnvironment);
102 yield* ipc.handle(disconnectSshEnvironment);
103 yield* ipc.handle(fetchSshEnvironmentDescriptor);
104 yield* ipc.handle(bootstrapSshBearerSession);
105 yield* ipc.handle(fetchSshSessionState);
106 yield* ipc.handle(issueSshWebSocketTicket);
107 yield* ipc.handle(resolveSshPasswordPrompt);
108​
109 yield* ipc.handle(getServerExposureState);
110 yield* ipc.handle(setServerExposureMode);
111 yield* ipc.handle(setTailscaleServeEnabled);
112 yield* ipc.handle(getAdvertisedEndpoints);
113​
114 yield* ipc.handle(getWslState);
115 yield* ipc.handle(setWslBackendEnabled);
116 yield* ipc.handle(setWslDistro);
117 yield* ipc.handle(setWslOnly);
118​
119 yield* ipc.handle(pickFolder);
120 yield* ipc.handle(pickProjectFavicon);
121 yield* ipc.handle(pickThemeFiles);
122 yield* ipc.handle(setTheme);
123 yield* ipc.handle(showContextMenu);
124 yield* ipc.handle(openExternal);
125 yield* ipc.handle(openSystemSettings);
126 yield* ipc.handle(checkSystemPermission);
127 yield* ipc.handle(probeRemoteEditors);
128 yield* ipc.handle(getUpdateState);
129 yield* ipc.handle(setUpdateChannel);
130 yield* ipc.handle(downloadUpdate);
131 yield* ipc.handle(installUpdate);
132 yield* ipc.handle(checkForUpdate);
133 for (const previewMethod of PreviewIpc.methods) {
134 yield* ipc.handle(previewMethod);
135 }
136 yield* ipc.handle(PreviewIpc.listBrowserImportSources);
137 yield* ipc.handle(PreviewIpc.importBrowserCookies);
138});