Open History to see the last commit
1import * as Effect from "effect/Effect";
2
3import { receiveProviderAuthCallback, cancelProviderAuthCallback } from "./methods/providerAuth.ts";
4import * as DesktopIpc from "./DesktopIpc.ts";
5import { installNotificationBadge } from "./methods/notificationBadge.ts";
6import { getClientSettings, setClientSettings } from "./methods/clientSettings.ts";
7import { getConnectionCatalog, setConnectionCatalog } from "./methods/connectionCatalog.ts";
8import {
9 getHostEnvironmentId,
10 getLocalEnvironmentEnabled,
11 setLocalEnvironmentEnabled,
12} from "./methods/localEnvironment.ts";
13import {
14 getAdvertisedEndpoints,
15 getServerExposureState,
16 setServerExposureMode,
17 setTailscaleServeEnabled,
18} from "./methods/serverExposure.ts";
19import {
20 bootstrapSshBearerSession,
21 disconnectSshEnvironment,
22 discoverSshHosts,
23 ensureSshEnvironment,
24 fetchSshEnvironmentDescriptor,
25 fetchSshSessionState,
26 resolveSshHost,
27 resolveSshPasswordPrompt,
28} from "./methods/sshEnvironment.ts";
29import {
30 checkForUpdate,
31 downloadUpdate,
32 getUpdateState,
33 installUpdate,
34 setUpdateChannel,
35} from "./methods/updates.ts";
36import {
37 getAppBranding,
38 getLocalEnvironmentBootstraps,
39 getLocalEnvironmentBearerToken,
40 installRelayTelemetryEnabled,
41 getSystemLocale,
42 getPreferredSystemLanguages,
43 getWindowFullscreenState,
44 openExternal,
45 readMedia,
46 openSystemSettings,
47 checkSystemPermission,
48 pasteAsText,
49 probeRemoteEditors,
50 revealWindow,
51 pickFolder,
52 pickProjectFavicon,
53 pickThemeFiles,
54 setTheme,
55 syncHtmlFullscreen,
56 showContextMenu,
57} from "./methods/window.ts";
58import {
59 acknowledgeSnapShot,
60 checkSnapShotShortcut,
61 dismissSnapShotAnimation,
62 getSnapShotState,
63 setupSnapShot,
64 previewSnapShotConfig,
65 applySnapShotConfig,
66 listPendingSnapShots,
67 readSnapShot,
68 requestSnapShotPermissions,
69 setSnapShotAnimationDestination,
70 setSnapShotShortcutSuppressed,
71} from "./methods/snapShot.ts";
72import * as PreviewIpc from "./methods/preview.ts";
73import * as AppActivationIpc from "./methods/appActivation.ts";
74import * as WebLinksIpc from "./methods/webLinks.ts";
75import {
76 completeLegacyLocalStorage,
77 takeLegacyLocalStorage,
78} from "./methods/legacyLocalStorage.ts";
79import { getWslState, setWslBackendEnabled, setWslDistro, setWslOnly } from "./methods/wsl.ts";
80import {
81 getCliCommandState,
82 installCliCommand,
83 uninstallCliCommand,
84 addCliCommandToPath,
85} from "./methods/cliCommand.ts";
86
87export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
88 const ipc = yield* DesktopIpc.DesktopIpc;
89 yield* installNotificationBadge();
90 yield* PreviewIpc.installPreviewEventForwarding();
91
92 yield* ipc.handle(AppActivationIpc.setReady);
93 yield* ipc.handle(AppActivationIpc.complete);
94 yield* ipc.handle(WebLinksIpc.setReady);
95
96 yield* ipc.handleSync(takeLegacyLocalStorage);
97 yield* ipc.handle(completeLegacyLocalStorage);
98 yield* ipc.handleSync(getAppBranding);
99 yield* installRelayTelemetryEnabled();
100 yield* ipc.handleSync(getSystemLocale);
101 yield* ipc.handleSync(getPreferredSystemLanguages);
102 yield* ipc.handleSync(getWindowFullscreenState);
103 yield* ipc.handleSync(getLocalEnvironmentBootstraps);
104 yield* ipc.handleSync(getLocalEnvironmentEnabled);
105 yield* ipc.handle(setLocalEnvironmentEnabled);
106 yield* ipc.handle(getHostEnvironmentId);
107 yield* ipc.handle(getLocalEnvironmentBearerToken);
108
109 yield* ipc.handle(getClientSettings);
110 yield* ipc.handle(setClientSettings);
111 yield* ipc.handle(getConnectionCatalog);
112 yield* ipc.handle(getSnapShotState);
113 yield* ipc.handle(setupSnapShot);
114 yield* ipc.handle(previewSnapShotConfig);
115 yield* ipc.handle(applySnapShotConfig);
116 yield* ipc.handle(requestSnapShotPermissions);
117 yield* ipc.handle(checkSnapShotShortcut);
118 yield* ipc.handle(setSnapShotShortcutSuppressed);
119 yield* ipc.handle(listPendingSnapShots);
120 yield* ipc.handle(readSnapShot);
121 yield* ipc.handle(setSnapShotAnimationDestination);
122 yield* ipc.handle(dismissSnapShotAnimation);
123 yield* ipc.handle(acknowledgeSnapShot);
124 yield* ipc.handle(setConnectionCatalog);
125
126 yield* ipc.handle(discoverSshHosts);
127 yield* ipc.handle(resolveSshHost);
128 yield* ipc.handle(ensureSshEnvironment);
129 yield* ipc.handle(disconnectSshEnvironment);
130 yield* ipc.handle(fetchSshEnvironmentDescriptor);
131 yield* ipc.handle(bootstrapSshBearerSession);
132 yield* ipc.handle(fetchSshSessionState);
133 yield* ipc.handle(resolveSshPasswordPrompt);
134
135 yield* ipc.handle(getServerExposureState);
136 yield* ipc.handle(setServerExposureMode);
137 yield* ipc.handle(setTailscaleServeEnabled);
138 yield* ipc.handle(getAdvertisedEndpoints);
139
140 yield* ipc.handle(getWslState);
141 yield* ipc.handle(setWslBackendEnabled);
142 yield* ipc.handle(setWslDistro);
143 yield* ipc.handle(setWslOnly);
144
145 yield* ipc.handle(pickFolder);
146 yield* ipc.handle(pickProjectFavicon);
147 yield* ipc.handle(pickThemeFiles);
148 yield* ipc.handle(setTheme);
149 yield* ipc.handle(showContextMenu);
150 yield* ipc.handle(openExternal);
151 yield* ipc.handle(readMedia);
152 yield* ipc.handle(receiveProviderAuthCallback);
153 yield* ipc.handle(cancelProviderAuthCallback);
154 yield* ipc.handle(openSystemSettings);
155 yield* ipc.handle(checkSystemPermission);
156 yield* ipc.handle(pasteAsText);
157 yield* ipc.handle(revealWindow);
158 yield* ipc.handle(syncHtmlFullscreen);
159 yield* ipc.handle(probeRemoteEditors);
160 yield* ipc.handle(getUpdateState);
161 yield* ipc.handle(setUpdateChannel);
162 yield* ipc.handle(downloadUpdate);
163 yield* ipc.handle(installUpdate);
164 yield* ipc.handle(checkForUpdate);
165 yield* ipc.handle(getCliCommandState);
166 yield* ipc.handle(installCliCommand);
167 yield* ipc.handle(uninstallCliCommand);
168 yield* ipc.handle(addCliCommandToPath);
169 for (const previewMethod of PreviewIpc.methods) {
170 // Explicit types preserve the error/service union of these heterogeneous preview methods.
171 yield* ipc.handle<
172 Effect.Error<ReturnType<(typeof PreviewIpc.methods)[number]["handler"]>>,
173 Effect.Services<ReturnType<(typeof PreviewIpc.methods)[number]["handler"]>>
174 >(previewMethod);
175 }
176 yield* ipc.handle(PreviewIpc.listBrowserImportSources);
177 yield* ipc.handle(PreviewIpc.importBrowserCookies);
178});