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

DesktopIpcHandlers.ts

142 lines4.5 KB

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