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

DesktopIpcHandlers.ts

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