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