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

DesktopIpcHandlers.ts

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