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

DesktopIpcHandlers.ts

173 lines5.7 KB

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 {
8 clearConnectionCatalog,
9 getConnectionCatalog,
10 setConnectionCatalog,
11} from "./methods/connectionCatalog.ts";
12import {
13 getLocalEnvironmentEnabled,
14 setLocalEnvironmentEnabled,
15} from "./methods/localEnvironment.ts";
16import {
17 getAdvertisedEndpoints,
18 getServerExposureState,
19 setServerExposureMode,
20 setTailscaleServeEnabled,
21} from "./methods/serverExposure.ts";
22import {
23 bootstrapSshBearerSession,
24 disconnectSshEnvironment,
25 discoverSshHosts,
26 ensureSshEnvironment,
27 fetchSshEnvironmentDescriptor,
28 fetchSshSessionState,
29 issueSshWebSocketTicket,
30 resolveSshHost,
31 resolveSshPasswordPrompt,
32} from "./methods/sshEnvironment.ts";
33import {
34 checkForUpdate,
35 downloadUpdate,
36 getUpdateState,
37 installUpdate,
38 setUpdateChannel,
39} from "./methods/updates.ts";
40import {
41 getAppBranding,
42 getLocalEnvironmentBootstraps,
43 readLocalEnvironmentBootstraps,
44 getLocalEnvironmentBearerToken,
45 getRelayTelemetryEnabled,
46 getSystemLocale,
47 getWindowFullscreenState,
48 openExternal,
49 openSystemSettings,
50 checkSystemPermission,
51 pasteAsText,
52 probeRemoteEditors,
53 revealWindow,
54 pickFolder,
55 pickProjectFavicon,
56 pickThemeFiles,
57 setTheme,
58 showContextMenu,
59} from "./methods/window.ts";
60import {
61 acknowledgeSnapShot,
62 checkSnapShotShortcut,
63 dismissSnapShotAnimation,
64 getSnapShotState,
65 setupSnapShot,
66 previewSnapShotConfig,
67 applySnapShotConfig,
68 listPendingSnapShots,
69 readSnapShot,
70 requestSnapShotPermissions,
71 setSnapShotAnimationDestination,
72 setSnapShotShortcutSuppressed,
73} from "./methods/snapShot.ts";
74import * as PreviewIpc from "./methods/preview.ts";
75import * as AppActivationIpc from "./methods/appActivation.ts";
76import * as WebLinksIpc from "./methods/webLinks.ts";
77import {
78 completeLegacyLocalStorage,
79 takeLegacyLocalStorage,
80} from "./methods/legacyLocalStorage.ts";
81import { getWslState, setWslBackendEnabled, setWslDistro, setWslOnly } from "./methods/wsl.ts";
82import {
83 getCliCommandState,
84 installCliCommand,
85 uninstallCliCommand,
86} from "./methods/cliCommand.ts";
87​
88export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
89 const ipc = yield* DesktopIpc.DesktopIpc;
90 yield* installNotificationBadge();
91 yield* PreviewIpc.installPreviewEventForwarding();
92​
93 yield* ipc.handle(AppActivationIpc.setReady);
94 yield* ipc.handle(AppActivationIpc.complete);
95 yield* ipc.handle(WebLinksIpc.setReady);
96​
97 yield* ipc.handleSync(takeLegacyLocalStorage);
98 yield* ipc.handle(completeLegacyLocalStorage);
99 yield* ipc.handleSync(getAppBranding);
100 yield* ipc.handleSync(getRelayTelemetryEnabled);
101 yield* ipc.handleSync(getSystemLocale);
102 yield* ipc.handleSync(getWindowFullscreenState);
103 yield* ipc.handleSync(getLocalEnvironmentBootstraps);
104 yield* ipc.handle(readLocalEnvironmentBootstraps);
105 yield* ipc.handleSync(getLocalEnvironmentEnabled);
106 yield* ipc.handle(setLocalEnvironmentEnabled);
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 yield* ipc.handle(clearConnectionCatalog);
126​
127 yield* ipc.handle(discoverSshHosts);
128 yield* ipc.handle(resolveSshHost);
129 yield* ipc.handle(ensureSshEnvironment);
130 yield* ipc.handle(disconnectSshEnvironment);
131 yield* ipc.handle(fetchSshEnvironmentDescriptor);
132 yield* ipc.handle(bootstrapSshBearerSession);
133 yield* ipc.handle(fetchSshSessionState);
134 yield* ipc.handle(issueSshWebSocketTicket);
135 yield* ipc.handle(resolveSshPasswordPrompt);
136​
137 yield* ipc.handle(getServerExposureState);
138 yield* ipc.handle(setServerExposureMode);
139 yield* ipc.handle(setTailscaleServeEnabled);
140 yield* ipc.handle(getAdvertisedEndpoints);
141​
142 yield* ipc.handle(getWslState);
143 yield* ipc.handle(setWslBackendEnabled);
144 yield* ipc.handle(setWslDistro);
145 yield* ipc.handle(setWslOnly);
146​
147 yield* ipc.handle(pickFolder);
148 yield* ipc.handle(pickProjectFavicon);
149 yield* ipc.handle(pickThemeFiles);
150 yield* ipc.handle(setTheme);
151 yield* ipc.handle(showContextMenu);
152 yield* ipc.handle(openExternal);
153 yield* ipc.handle(receiveProviderAuthCallback);
154 yield* ipc.handle(cancelProviderAuthCallback);
155 yield* ipc.handle(openSystemSettings);
156 yield* ipc.handle(checkSystemPermission);
157 yield* ipc.handle(pasteAsText);
158 yield* ipc.handle(revealWindow);
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 for (const previewMethod of PreviewIpc.methods) {
169 yield* ipc.handle(previewMethod);
170 }
171 yield* ipc.handle(PreviewIpc.listBrowserImportSources);
172 yield* ipc.handle(PreviewIpc.importBrowserCookies);
173});