100 lines · 3.0 KB · TypeScript
RawDownload
import * as Effect from "effect/Effect"; import * as DesktopIpc from "./DesktopIpc.ts";import {  clearCloudAuthToken,  createCloudAuthRequest,  fetchCloudAuth,  getCloudAuthToken,  setCloudAuthToken,} from "./methods/cloudAuth.ts";import { getClientSettings, setClientSettings } from "./methods/clientSettings.ts";import {  getSavedEnvironmentRegistry,  getSavedEnvironmentSecret,  removeSavedEnvironmentSecret,  setSavedEnvironmentRegistry,  setSavedEnvironmentSecret,} from "./methods/savedEnvironments.ts";import {  getAdvertisedEndpoints,  getServerExposureState,  setServerExposureMode,  setTailscaleServeEnabled,} from "./methods/serverExposure.ts";import {  bootstrapSshBearerSession,  disconnectSshEnvironment,  discoverSshHosts,  ensureSshEnvironment,  fetchSshEnvironmentDescriptor,  fetchSshSessionState,  issueSshWebSocketTicket,  resolveSshPasswordPrompt,} from "./methods/sshEnvironment.ts";import {  checkForUpdate,  downloadUpdate,  getUpdateState,  installUpdate,  setUpdateChannel,} from "./methods/updates.ts";import {  confirm,  getAppBranding,  getLocalEnvironmentBootstrap,  openExternal,  pickFolder,  setTheme,  showContextMenu,} from "./methods/window.ts";import * as PreviewIpc from "./methods/preview.ts"; export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {  const ipc = yield* DesktopIpc.DesktopIpc;  yield* PreviewIpc.installPreviewEventForwarding();   yield* ipc.handleSync(getAppBranding);  yield* ipc.handleSync(getLocalEnvironmentBootstrap);   yield* ipc.handle(getClientSettings);  yield* ipc.handle(setClientSettings);  yield* ipc.handle(getSavedEnvironmentRegistry);  yield* ipc.handle(setSavedEnvironmentRegistry);  yield* ipc.handle(getSavedEnvironmentSecret);  yield* ipc.handle(setSavedEnvironmentSecret);  yield* ipc.handle(removeSavedEnvironmentSecret);   yield* ipc.handle(discoverSshHosts);  yield* ipc.handle(ensureSshEnvironment);  yield* ipc.handle(disconnectSshEnvironment);  yield* ipc.handle(fetchSshEnvironmentDescriptor);  yield* ipc.handle(bootstrapSshBearerSession);  yield* ipc.handle(fetchSshSessionState);  yield* ipc.handle(issueSshWebSocketTicket);  yield* ipc.handle(resolveSshPasswordPrompt);   yield* ipc.handle(getServerExposureState);  yield* ipc.handle(setServerExposureMode);  yield* ipc.handle(setTailscaleServeEnabled);  yield* ipc.handle(getAdvertisedEndpoints);   yield* ipc.handle(pickFolder);  yield* ipc.handle(confirm);  yield* ipc.handle(setTheme);  yield* ipc.handle(showContextMenu);  yield* ipc.handle(openExternal);  yield* ipc.handle(createCloudAuthRequest);  yield* ipc.handle(getCloudAuthToken);  yield* ipc.handle(setCloudAuthToken);  yield* ipc.handle(clearCloudAuthToken);  yield* ipc.handle(fetchCloudAuth);  yield* ipc.handle(getUpdateState);  yield* ipc.handle(setUpdateChannel);  yield* ipc.handle(downloadUpdate);  yield* ipc.handle(installUpdate);  yield* ipc.handle(checkForUpdate);  for (const previewMethod of PreviewIpc.methods) {    yield* ipc.handle(previewMethod);  }});