| author | |
| committer | |
| log | 5b8a69c7b90b751507d0ab762dd77aaa2048408b |
| tree | 45353c30f4ee1a0ebf7464bd121ffbf1be745000 |
| parent | 3bf74eb6dce3e1372cfafc2ca84825f4b13bae6a |
| signature | Signed by PGP key B5690EEEBB952194 |
10 files changed, 14 insertions(+), 59 deletions(-)
apps/desktop/scripts/electron-launcher.mjs+3-3| ... | @@ -15,8 +15,8 @@ const repoRoot = NodePath.resolve(desktopDir, "..", ".."); | ... | @@ -15,8 +15,8 @@ const repoRoot = NodePath.resolve(desktopDir, "..", ".."); |
| 15 | const devBundleIdSuffix = NodePath.basename(repoRoot) | 15 | const devBundleIdSuffix = NodePath.basename(repoRoot) |
| 16 | .toLowerCase() | 16 | .toLowerCase() |
| 17 | .replaceAll(/[^a-z0-9]+/g, ""); | 17 | .replaceAll(/[^a-z0-9]+/g, ""); |
| 18 | export const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; | 18 | const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; |
| 19 | export const APP_BUNDLE_ID = isDevelopment | 19 | const APP_BUNDLE_ID = isDevelopment |
| 20 | ? `com.t3tools.t3code.dev.${devBundleIdSuffix || "local"}` | 20 | ? `com.t3tools.t3code.dev.${devBundleIdSuffix || "local"}` |
| 21 | : "com.t3tools.t3code"; | 21 | : "com.t3tools.t3code"; |
| 22 | const APP_PROTOCOL_SCHEMES = isDevelopment ? ["t3code-dev"] : ["t3code"]; | 22 | const APP_PROTOCOL_SCHEMES = isDevelopment ? ["t3code-dev"] : ["t3code"]; |
| ... | @@ -387,7 +387,7 @@ function resolveLinuxSandboxArgs(electronBinaryPath) { | ... | @@ -387,7 +387,7 @@ function resolveLinuxSandboxArgs(electronBinaryPath) { |
| 387 | return ["--no-sandbox"]; | 387 | return ["--no-sandbox"]; |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | export function resolveElectronPath() { | 390 | function resolveElectronPath() { |
| 391 | const electronBinaryPath = resolveElectronBinaryPath(); | 391 | const electronBinaryPath = resolveElectronBinaryPath(); |
| 392 | 392 | ||
| 393 | if (hostPlatform !== "darwin") { | 393 | if (hostPlatform !== "darwin") { |
apps/desktop/src/backend/DesktopBackendConfiguration.ts+1| ... | @@ -737,6 +737,7 @@ const resolveWslStartConfig = Effect.fn("desktop.backendConfiguration.resolveWsl | ... | @@ -737,6 +737,7 @@ const resolveWslStartConfig = Effect.fn("desktop.backendConfiguration.resolveWsl |
| 737 | } satisfies DesktopBackendManager.DesktopBackendStartConfig; | 737 | } satisfies DesktopBackendManager.DesktopBackendStartConfig; |
| 738 | }); | 738 | }); |
| 739 | 739 | ||
| 740 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 740 | export const make = Effect.gen(function* () { | 741 | export const make = Effect.gen(function* () { |
| 741 | const environment = yield* DesktopEnvironment.DesktopEnvironment; | 742 | const environment = yield* DesktopEnvironment.DesktopEnvironment; |
| 742 | const fileSystem = yield* FileSystem.FileSystem; | 743 | const fileSystem = yield* FileSystem.FileSystem; |
apps/desktop/src/backend/DesktopLocalEnvironmentAuth.ts+1| ... | @@ -42,6 +42,7 @@ export class DesktopLocalEnvironmentAuth extends Context.Service< | ... | @@ -42,6 +42,7 @@ export class DesktopLocalEnvironmentAuth extends Context.Service< |
| 42 | } | 42 | } |
| 43 | >()("@t3tools/desktop/backend/DesktopLocalEnvironmentAuth") {} | 43 | >()("@t3tools/desktop/backend/DesktopLocalEnvironmentAuth") {} |
| 44 | 44 | ||
| 45 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 45 | export const make = Effect.gen(function* () { | 46 | export const make = Effect.gen(function* () { |
| 46 | const pool = yield* DesktopBackendPool.DesktopBackendPool; | 47 | const pool = yield* DesktopBackendPool.DesktopBackendPool; |
| 47 | const httpClient = yield* HttpClient.HttpClient; | 48 | const httpClient = yield* HttpClient.HttpClient; |
apps/desktop/src/backend/DesktopNetworkInterfaces.ts+1| ... | @@ -39,6 +39,7 @@ export class DesktopNetworkInterfaces extends Context.Service< | ... | @@ -39,6 +39,7 @@ export class DesktopNetworkInterfaces extends Context.Service< |
| 39 | } | 39 | } |
| 40 | >()("@t3tools/desktop/backend/DesktopNetworkInterfaces") {} | 40 | >()("@t3tools/desktop/backend/DesktopNetworkInterfaces") {} |
| 41 | 41 | ||
| 42 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 42 | export const make = Effect.gen(function* () { | 43 | export const make = Effect.gen(function* () { |
| 43 | const platform = yield* HostProcessPlatform; | 44 | const platform = yield* HostProcessPlatform; |
| 44 | return DesktopNetworkInterfaces.of({ | 45 | return DesktopNetworkInterfaces.of({ |
apps/desktop/src/backend/DesktopServerExposure.ts+2-1| ... | @@ -27,7 +27,7 @@ import { resolveTailscaleAdvertisedEndpoints } from "./tailscaleEndpointProvider | ... | @@ -27,7 +27,7 @@ import { resolveTailscaleAdvertisedEndpoints } from "./tailscaleEndpointProvider |
| 27 | 27 | ||
| 28 | const TAILSCALE_STATUS_CACHE_TTL = Duration.seconds(60); | 28 | const TAILSCALE_STATUS_CACHE_TTL = Duration.seconds(60); |
| 29 | 29 | ||
| 30 | export const DESKTOP_LOOPBACK_HOST = "127.0.0.1"; | 30 | const DESKTOP_LOOPBACK_HOST = "127.0.0.1"; |
| 31 | const DESKTOP_LAN_BIND_HOST = "0.0.0.0"; | 31 | const DESKTOP_LAN_BIND_HOST = "0.0.0.0"; |
| 32 | 32 | ||
| 33 | interface ResolvedDesktopServerExposure { | 33 | interface ResolvedDesktopServerExposure { |
| ... | @@ -411,6 +411,7 @@ const requiresBackendRelaunch = (previous: RuntimeState, next: RuntimeState): bo | ... | @@ -411,6 +411,7 @@ const requiresBackendRelaunch = (previous: RuntimeState, next: RuntimeState): bo |
| 411 | previous.bindHost !== next.bindHost || | 411 | previous.bindHost !== next.bindHost || |
| 412 | previous.localHttpUrl !== next.localHttpUrl; | 412 | previous.localHttpUrl !== next.localHttpUrl; |
| 413 | 413 | ||
| 414 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 414 | export const make = Effect.gen(function* () { | 415 | export const make = Effect.gen(function* () { |
| 415 | const config = yield* DesktopConfig.DesktopConfig; | 416 | const config = yield* DesktopConfig.DesktopConfig; |
| 416 | const networkInterfaces = yield* DesktopNetworkInterfaces.DesktopNetworkInterfaces; | 417 | const networkInterfaces = yield* DesktopNetworkInterfaces.DesktopNetworkInterfaces; |
apps/desktop/src/backend/tailscaleEndpointProvider.ts+1-1| ... | @@ -14,7 +14,7 @@ import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawne | ... | @@ -14,7 +14,7 @@ import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawne |
| 14 | 14 | ||
| 15 | import type { NetworkInterfaces } from "./DesktopNetworkInterfaces.ts"; | 15 | import type { NetworkInterfaces } from "./DesktopNetworkInterfaces.ts"; |
| 16 | 16 | ||
| 17 | export { isTailscaleIpv4Address, parseTailscaleMagicDnsName } from "@t3tools/tailscale"; | 17 | export { parseTailscaleMagicDnsName } from "@t3tools/tailscale"; |
| 18 | 18 | ||
| 19 | const TAILSCALE_ENDPOINT_PROVIDER: AdvertisedEndpointProvider = { | 19 | const TAILSCALE_ENDPOINT_PROVIDER: AdvertisedEndpointProvider = { |
| 20 | id: "tailscale", | 20 | id: "tailscale", |
apps/desktop/src/settings/DesktopAppSettings.ts+2-1| ... | @@ -55,7 +55,7 @@ export interface DesktopSettingsChange { | ... | @@ -55,7 +55,7 @@ export interface DesktopSettingsChange { |
| 55 | readonly changed: boolean; | 55 | readonly changed: boolean; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | export const DEFAULT_TAILSCALE_SERVE_PORT = 443; | 58 | const DEFAULT_TAILSCALE_SERVE_PORT = 443; |
| 59 | const MIN_MAIN_WINDOW_SIZE = { | 59 | const MIN_MAIN_WINDOW_SIZE = { |
| 60 | width: 840, | 60 | width: 840, |
| 61 | height: 620, | 61 | height: 620, |
| ... | @@ -450,6 +450,7 @@ const writeSettings = Effect.fn("desktop.settings.writeSettings")(function* (inp | ... | @@ -450,6 +450,7 @@ const writeSettings = Effect.fn("desktop.settings.writeSettings")(function* (inp |
| 450 | ); | 450 | ); |
| 451 | }); | 451 | }); |
| 452 | 452 | ||
| 453 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 453 | export const make = Effect.gen(function* () { | 454 | export const make = Effect.gen(function* () { |
| 454 | const environment = yield* DesktopEnvironment.DesktopEnvironment; | 455 | const environment = yield* DesktopEnvironment.DesktopEnvironment; |
| 455 | const fileSystem = yield* FileSystem.FileSystem; | 456 | const fileSystem = yield* FileSystem.FileSystem; |
apps/desktop/src/settings/DesktopSavedEnvironments.ts+1-53| ... | @@ -9,7 +9,6 @@ import * as Layer from "effect/Layer"; | ... | @@ -9,7 +9,6 @@ import * as Layer from "effect/Layer"; |
| 9 | import * as Option from "effect/Option"; | 9 | import * as Option from "effect/Option"; |
| 10 | import * as Path from "effect/Path"; | 10 | import * as Path from "effect/Path"; |
| 11 | import * as Schema from "effect/Schema"; | 11 | import * as Schema from "effect/Schema"; |
| 12 | import * as Ref from "effect/Ref"; | ||
| 13 | 12 | ||
| 14 | import * as DesktopEnvironment from "../app/DesktopEnvironment.ts"; | 13 | import * as DesktopEnvironment from "../app/DesktopEnvironment.ts"; |
| 15 | import * as ElectronSafeStorage from "../electron/ElectronSafeStorage.ts"; | 14 | import * as ElectronSafeStorage from "../electron/ElectronSafeStorage.ts"; |
| ... | @@ -365,6 +364,7 @@ function decodeSecretBytes( | ... | @@ -365,6 +364,7 @@ function decodeSecretBytes( |
| 365 | ); | 364 | ); |
| 366 | } | 365 | } |
| 367 | 366 | ||
| 367 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 368 | export const make = Effect.gen(function* () { | 368 | export const make = Effect.gen(function* () { |
| 369 | const environment = yield* DesktopEnvironment.DesktopEnvironment; | 369 | const environment = yield* DesktopEnvironment.DesktopEnvironment; |
| 370 | const fileSystem = yield* FileSystem.FileSystem; | 370 | const fileSystem = yield* FileSystem.FileSystem; |
| ... | @@ -555,55 +555,3 @@ export const make = Effect.gen(function* () { | ... | @@ -555,55 +555,3 @@ export const make = Effect.gen(function* () { |
| 555 | }); | 555 | }); |
| 556 | 556 | ||
| 557 | export const layer = Layer.effect(DesktopSavedEnvironments, make); | 557 | export const layer = Layer.effect(DesktopSavedEnvironments, make); |
| 558 | |||
| 559 | export const layerTest = (input?: { | ||
| 560 | readonly records?: readonly PersistedSavedEnvironmentRecord[]; | ||
| 561 | readonly secrets?: ReadonlyMap<string, string>; | ||
| 562 | }) => | ||
| 563 | Layer.effect( | ||
| 564 | DesktopSavedEnvironments, | ||
| 565 | Effect.gen(function* () { | ||
| 566 | const recordsRef = yield* Ref.make(input?.records ?? []); | ||
| 567 | const secretsRef = yield* Ref.make(new Map(input?.secrets ?? [])); | ||
| 568 | |||
| 569 | return DesktopSavedEnvironments.of({ | ||
| 570 | getRegistry: Ref.get(recordsRef), | ||
| 571 | setRegistry: (records) => Ref.set(recordsRef, records), | ||
| 572 | removeEnvironment: (environmentId) => | ||
| 573 | Ref.update(recordsRef, (records) => | ||
| 574 | records.filter((record) => record.environmentId !== environmentId), | ||
| 575 | ).pipe( | ||
| 576 | Effect.andThen( | ||
| 577 | Ref.update(secretsRef, (secrets) => { | ||
| 578 | const nextSecrets = new Map(secrets); | ||
| 579 | nextSecrets.delete(environmentId); | ||
| 580 | return nextSecrets; | ||
| 581 | }), | ||
| 582 | ), | ||
| 583 | ), | ||
| 584 | getSecret: (environmentId) => | ||
| 585 | Ref.get(secretsRef).pipe( | ||
| 586 | Effect.map((secrets) => Option.fromNullishOr(secrets.get(environmentId))), | ||
| 587 | ), | ||
| 588 | setSecret: ({ environmentId, secret }) => | ||
| 589 | Ref.get(recordsRef).pipe( | ||
| 590 | Effect.flatMap((records) => { | ||
| 591 | if (!records.some((record) => record.environmentId === environmentId)) { | ||
| 592 | return Effect.succeed(false); | ||
| 593 | } | ||
| 594 | return Ref.update(secretsRef, (secrets) => { | ||
| 595 | const nextSecrets = new Map(secrets); | ||
| 596 | nextSecrets.set(environmentId, secret); | ||
| 597 | return nextSecrets; | ||
| 598 | }).pipe(Effect.as(true)); | ||
| 599 | }), | ||
| 600 | ), | ||
| 601 | removeSecret: (environmentId) => | ||
| 602 | Ref.update(secretsRef, (secrets) => { | ||
| 603 | const nextSecrets = new Map(secrets); | ||
| 604 | nextSecrets.delete(environmentId); | ||
| 605 | return nextSecrets; | ||
| 606 | }), | ||
| 607 | }); | ||
| 608 | }), | ||
| 609 | ); |
apps/desktop/src/telemetry/DesktopTelemetryPublisher.ts+1| ... | @@ -145,6 +145,7 @@ function sampleInterval( | ... | @@ -145,6 +145,7 @@ function sampleInterval( |
| 145 | return LIVE_SAMPLE_INTERVAL; | 145 | return LIVE_SAMPLE_INTERVAL; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 148 | export const make = Effect.fn("desktop.telemetryPublisher.make")(function* () { | 149 | export const make = Effect.fn("desktop.telemetryPublisher.make")(function* () { |
| 149 | const electronApp = yield* ElectronApp.ElectronApp; | 150 | const electronApp = yield* ElectronApp.ElectronApp; |
| 150 | const powerMonitor = yield* ElectronPowerMonitor.ElectronPowerMonitor; | 151 | const powerMonitor = yield* ElectronPowerMonitor.ElectronPowerMonitor; |
apps/desktop/src/wsl/DesktopWslServerTree.ts+1| ... | @@ -116,6 +116,7 @@ const copyTree = ( | ... | @@ -116,6 +116,7 @@ const copyTree = ( |
| 116 | }), | 116 | }), |
| 117 | ); | 117 | ); |
| 118 | 118 | ||
| 119 | /** @public Service construction is part of the canonical Effect module API. */ | ||
| 119 | export const make = Effect.gen(function* () { | 120 | export const make = Effect.gen(function* () { |
| 120 | const environment = yield* DesktopEnvironment.DesktopEnvironment; | 121 | const environment = yield* DesktopEnvironment.DesktopEnvironment; |
| 121 | const fs = yield* FileSystem.FileSystem; | 122 | const fs = yield* FileSystem.FileSystem; |