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