Skip to content

An open-source, self-hosted system for apps built with web technologies.

Simplify client launch and window contracts

zohayrslileh6fe75f321337
diff --git a/scripts/contracts/client-launch.ts b/scripts/contracts/client-launch.ts
index b5775d0..b42d1b4 100644
--- a/scripts/contracts/client-launch.ts
+++ b/scripts/contracts/client-launch.ts
@@ -13,7 +13,6 @@ const manager = {
const program = {
client: {},
- clientLocation: "/client",
title: "Declared title"
}
diff --git a/scripts/contracts/client-sandbox.ts b/scripts/contracts/client-sandbox.ts
index e47af9d..ed690a4 100644
--- a/scripts/contracts/client-sandbox.ts
+++ b/scripts/contracts/client-sandbox.ts
@@ -25,7 +25,7 @@ const process = new Process(
process.startClient(new Window(
- { title: "Client", layer: "window", location: "/" },
+ { title: "Client", layer: "window" },
{ x: 0, y: 0 },
diff --git a/scripts/contracts/client-surface.ts b/scripts/contracts/client-surface.ts
index 775f379..c16a58e 100644
--- a/scripts/contracts/client-surface.ts
+++ b/scripts/contracts/client-surface.ts
@@ -12,7 +12,7 @@ import type { AppearanceTransaction, WaitedTransaction, WindowLayer } from "@phr
type RequestedTransaction = AppearanceTransaction | WaitedTransaction
const authoritativeWindow = new ServerWindow(
- { title: "Target", layer: "over", location: "/" },
+ { title: "Target", layer: "over" },
{ x: 0, y: 0 },
{ width: 100, height: 100 },
1,
@@ -201,7 +201,7 @@ const authManager = {
}
const request = host(authManager as never, requester.identity, () => ({ size: { width: 1, height: 1 } }), () => "owner", localWindow as never)
-assert.deepEqual(await request("desktopSurface"), [{ size: { width: 1, height: 1 } }])
+assert.deepEqual(await request("desktopViewport"), [{ size: { width: 1, height: 1 } }])
const targetAddress = { identity: target.identity, reference: target.reference }
const requesterAddress = { identity: requester.identity, reference: requester.reference }
processes.delete(parent.identity)
@@ -254,7 +254,6 @@ function client(layer: WindowLayer) {
size: { width: 300, height: 200 },
minimized: false,
layer,
- location: "/",
depth: 1
}
}
diff --git a/scripts/contracts/permission-requests.ts b/scripts/contracts/permission-requests.ts
index 8b6bdad..b382632 100644
--- a/scripts/contracts/permission-requests.ts
+++ b/scripts/contracts/permission-requests.ts
@@ -21,7 +21,7 @@ try {
let accessUpdates = 0
const process = new Process("process", null, program, {}, { server: null, client: null, options: {} }, null, {} as HostTraffic, false)
- process.startClient(new Window({ title: "Client", layer: "window", location: "/" }, { x: 0, y: 0 }, { width: 640, height: 480 }, 1, false), false)
+ process.startClient(new Window({ title: "Client", layer: "window" }, { x: 0, y: 0 }, { width: 640, height: 480 }, 1, false), false)
const authManager = {
dialogManager: {
diff --git a/scripts/contracts/process-find-or-create.ts b/scripts/contracts/process-find-or-create.ts
index dbedbbd..a7e45a5 100644
--- a/scripts/contracts/process-find-or-create.ts
+++ b/scripts/contracts/process-find-or-create.ts
@@ -28,7 +28,6 @@ const program = {
minimize: undefined
},
title: "Example",
- clientLocation: "/",
async validate() {}
} as unknown as Program
diff --git a/scripts/contracts/process-lifecycle.ts b/scripts/contracts/process-lifecycle.ts
index 8d761f3..6c5db0a 100644
--- a/scripts/contracts/process-lifecycle.ts
+++ b/scripts/contracts/process-lifecycle.ts
@@ -111,10 +111,10 @@ async function register(manager: ProcessManager, identity: string) {
null,
client,
{},
- { ...launch, client: { title: "Partial", position: null, size: null, layer: "window", location: "/", minimize: false, service: false } },
+ { ...launch, client: { title: "Partial", position: null, size: null, layer: "window", minimize: false, service: false } },
null,
true,
- { title: "Partial", position: { x: 0, y: 0 }, size: { width: 320, height: 240 }, layer: "window", location: "/", minimize: false },
+ { title: "Partial", position: { x: 0, y: 0 }, size: { width: 320, height: 240 }, layer: "window", minimize: false },
null
), /creation publication failed/)
diff --git a/scripts/contracts/program-frame.tsx b/scripts/contracts/program-frame.tsx
index 4dcf490..e31e3fa 100644
--- a/scripts/contracts/program-frame.tsx
+++ b/scripts/contracts/program-frame.tsx
@@ -5,7 +5,7 @@ import type Process from "@client/core/link-manager/auth-manager/process-manager
import type ClientState from "@client/core/link-manager/auth-manager/process-manager/client-state"
const record = { identity: "process", program: "program" } as Process
-const client = { sameOrigin: false, window: { location: "/" } } as ClientState
+const client = { sameOrigin: false, window: {} } as ClientState
const common = {
record,
assetId: "00000000-0000-4000-8000-000000000000",
diff --git a/scripts/contracts/window-geometry.ts b/scripts/contracts/window-geometry.ts
index 46906d6..8c624fe 100644
--- a/scripts/contracts/window-geometry.ts
+++ b/scripts/contracts/window-geometry.ts
@@ -10,7 +10,7 @@ const initial = {
}
const authority = new ServerWindow(
- { title: "Geometry", layer: "window", location: "/" },
+ { title: "Geometry", layer: "window" },
initial.position,
initial.size,
1,
diff --git a/source/client/core/link-manager/auth-manager/process-manager/window.ts b/source/client/core/link-manager/auth-manager/process-manager/window.ts
index 7c3bca8..bd2590c 100644
--- a/source/client/core/link-manager/auth-manager/process-manager/window.ts
+++ b/source/client/core/link-manager/auth-manager/process-manager/window.ts
@@ -34,17 +34,12 @@ export default class Window {
// The authoritative Desktop layer.
public layer: WindowLayer
- // Which of the half's own pages the frame opens on.
- public location: string
-
public constructor(processManager: ProcessManager, process: string, payload: WindowSnapshot) {
this.title = payload.title
this.layer = payload.layer
- this.location = payload.location
-
this.processManager = processManager
this.process = process
@@ -66,8 +61,6 @@ export default class Window {
this.layer = payload.layer
- this.location = payload.location
-
this.position = payload.position
this.size = payload.size
diff --git a/source/client/view/components/desktop-host/client-host.ts b/source/client/view/components/desktop-host/client-host.ts
index 260cbc3..d2091e0 100644
--- a/source/client/view/components/desktop-host/client-host.ts
+++ b/source/client/view/components/desktop-host/client-host.ts
@@ -1,5 +1,5 @@
import { ReactTunnel } from "@the-link/react"
-import { type DesktopSize, type DesktopSurfaceSnapshot } from "@phreshos/core"
+import { type DesktopSize, type DesktopViewportSnapshot } from "@phreshos/core"
import useAnnouncements from "./announcements"
import ClientProcessBoundary from "./client-process-boundary"
import ClientTraffic from "./client-traffic"
@@ -27,15 +27,15 @@ export default function useClientHost(authManager: AuthManager, desktop: RefObje
const [windowSurfaceSize, setWindowSurfaceSize] = useState<SurfaceSize>({ width: 0, height: 0 })
- const latestDesktopSurface = useRef<DesktopSurfaceSnapshot>({ size: { width: 0, height: 0 } })
+ const latestDesktopViewport = useRef<DesktopViewportSnapshot>({ size: { width: 0, height: 0 } })
- const desktopSurface = useCallback(function (): DesktopSurfaceSnapshot {
+ const desktopViewport = useCallback(function (): DesktopViewportSnapshot {
const bounds = desktop.current?.getBoundingClientRect()
return bounds
? { size: { width: Math.round(bounds.width), height: Math.round(bounds.height) } }
- : latestDesktopSurface.current
+ : latestDesktopViewport.current
}, [desktop])
@@ -50,13 +50,13 @@ export default function useClientHost(authManager: AuthManager, desktop: RefObje
function announceDesktop(size: DesktopSize) {
- const previous = latestDesktopSurface.current.size
+ const previous = latestDesktopViewport.current.size
if (previous.width === size.width && previous.height === size.height) return
const snapshot = { size }
- latestDesktopSurface.current = snapshot
+ latestDesktopViewport.current = snapshot
// Announcements leave directly from the full desktop measurement.
// Traffic carries them only to boundaries with a live interest.
@@ -64,7 +64,7 @@ export default function useClientHost(authManager: AuthManager, desktop: RefObje
for (const identity of sources.keys()) {
- traffic.emit(identity, "host-desktop-surface", "resize", snapshot).catch(() => undefined)
+ traffic.emit(identity, "host-desktop-viewport", "resize", snapshot).catch(() => undefined)
}
}
@@ -75,7 +75,7 @@ export default function useClientHost(authManager: AuthManager, desktop: RefObje
const initialDesktop = measure(desktop.current.getBoundingClientRect())
- latestDesktopSurface.current = { size: initialDesktop }
+ latestDesktopViewport.current = { size: initialDesktop }
const initialWindowSurface = windowSurfaceRef.current.getBoundingClientRect()
@@ -203,7 +203,7 @@ export default function useClientHost(authManager: AuthManager, desktop: RefObje
boundaries.current.get(identity)?.release().catch(() => undefined)
- boundaries.current.set(identity, new ClientProcessBoundary(identity, element, authManager, desktopSurface, traffic, localWindow))
+ boundaries.current.set(identity, new ClientProcessBoundary(identity, element, authManager, desktopViewport, traffic, localWindow))
return
}
@@ -218,7 +218,7 @@ export default function useClientHost(authManager: AuthManager, desktop: RefObje
boundary?.release().catch(() => undefined)
- }, [authManager, desktopSurface, localWindow, sources, traffic])
+ }, [authManager, desktopViewport, localWindow, sources, traffic])
const frameLoaded = useCallback(function (identity: string, element: HTMLIFrameElement) {
diff --git a/source/client/view/components/desktop-host/client-process-boundary.ts b/source/client/view/components/desktop-host/client-process-boundary.ts
index ae0f583..fc3f8d3 100644
--- a/source/client/view/components/desktop-host/client-process-boundary.ts
+++ b/source/client/view/components/desktop-host/client-process-boundary.ts
@@ -4,7 +4,7 @@ import host, { TransferredAnswer } from "./host"
import ClientTraffic from "./client-traffic"
import { failed, succeeded } from "@libs/request-outcome"
import { type TrafficKind } from "@server/core/link-manager/auth-manager/process-manager/process-traffic"
-import { isServiceKey, type DesktopSurfaceSnapshot, type ServiceKey, type ShellOptions } from "@phreshos/core"
+import { isServiceKey, type DesktopViewportSnapshot, type ServiceKey, type ShellOptions } from "@phreshos/core"
import { type LocalWindowHost } from "./local-window"
import messagepack from "@the-link/messagepack"
import { sdkProcess, type SdkProcessSource } from "./sdk-records"
@@ -19,7 +19,7 @@ export default class ClientProcessBoundary extends TheLink {
private readonly authManager: AuthManager
- private readonly desktop: () => DesktopSurfaceSnapshot
+ private readonly viewport: () => DesktopViewportSnapshot
private readonly traffic: ClientTraffic
@@ -60,7 +60,7 @@ export default class ClientProcessBoundary extends TheLink {
private leased: string | null = null
- public constructor(pane: string, element: HTMLIFrameElement, authManager: AuthManager, desktop: () => DesktopSurfaceSnapshot, traffic: ClientTraffic, localWindow: LocalWindowHost) {
+ public constructor(pane: string, element: HTMLIFrameElement, authManager: AuthManager, viewport: () => DesktopViewportSnapshot, traffic: ClientTraffic, localWindow: LocalWindowHost) {
super()
@@ -70,7 +70,7 @@ export default class ClientProcessBoundary extends TheLink {
this.authManager = authManager
- this.desktop = desktop
+ this.viewport = viewport
this.traffic = traffic
@@ -233,7 +233,7 @@ export default class ClientProcessBoundary extends TheLink {
this.trackSystemSubscription(values)
- host(this.authManager, this.pane, this.desktop, () => this.owner, this.localWindow)(values[0], ...values.slice(1)).catch((error: Error) => {
+ host(this.authManager, this.pane, this.viewport, () => this.owner, this.localWindow)(values[0], ...values.slice(1)).catch((error: Error) => {
if (values[0] === "observe" && typeof values[1] === "string" && values[6] === true) {
@@ -532,14 +532,14 @@ export default class ClientProcessBoundary extends TheLink {
this.answerRequest(
question,
- host(this.authManager, this.pane, this.desktop, () => this.owner, this.localWindow)(args[0], ...args.slice(1)),
+ host(this.authManager, this.pane, this.viewport, () => this.owner, this.localWindow)(args[0], ...args.slice(1)),
() => { this.authManager.cancelPermission(this.pane, args[1] as string).catch(() => undefined) }
)
return
}
- this.answerRequest(question, host(this.authManager, this.pane, this.desktop, () => this.owner, this.localWindow)(args[0], ...args.slice(1)))
+ this.answerRequest(question, host(this.authManager, this.pane, this.viewport, () => this.owner, this.localWindow)(args[0], ...args.slice(1)))
}
private answerRequest(question: string, operation: Promise<unknown[] | TransferredAnswer>, cancel: () => void = () => undefined) {
diff --git a/source/client/view/components/desktop-host/host.ts b/source/client/view/components/desktop-host/host.ts
index e6f12d9..d7f3d26 100644
--- a/source/client/view/components/desktop-host/host.ts
+++ b/source/client/view/components/desktop-host/host.ts
@@ -1,5 +1,5 @@
import {
- type DesktopSurfaceSnapshot,
+ type DesktopViewportSnapshot,
type Launch
} from "@phreshos/core"
import { type ProxyRequest } from "@server/core/protocol/proxy"
@@ -35,7 +35,7 @@ export class TransferredAnswer {
}
/** Adapts the complete System contract and contextual Desktop capabilities to one Client frame. */
-export default function host(authManager: AuthManager, pane: string, desktop: () => DesktopSurfaceSnapshot, frameOwner: () => string | null, localWindow: LocalWindowHost) {
+export default function host(authManager: AuthManager, pane: string, viewport: () => DesktopViewportSnapshot, frameOwner: () => string | null, localWindow: LocalWindowHost) {
const { processManager, programManager } = authManager
@@ -435,7 +435,7 @@ export default function host(authManager: AuthManager, pane: string, desktop: ()
const target = args[1] === null ? process() : resolveProcess(args[1])
// Callback subscriptions are synchronous and remain silent when
- // their source is unavailable. waitFor() and events() identify
+ // their source is unavailable. wait() and events() identify
// themselves as fallible, giving their boundary a real rejection
// path when this synchronized Process record proves impossibility.
if (!owner || !target) {
@@ -560,14 +560,6 @@ export default function host(authManager: AuthManager, pane: string, desktop: ()
return []
}
- // What a launch said. An empty subject is this frame's Process.
- if (word === "option") {
-
- const found = await permittedProcess(args[0])
-
- return [found.options[String(args[1])]]
- }
-
// The Program belonging to the current Client Context.
if (word === "current-program") {
@@ -692,14 +684,8 @@ export default function host(authManager: AuthManager, pane: string, desktop: ()
front: processManager.front(shown.layer) === target.identity,
- // Which layer it lives in, and which of its own pages it
- // was opened at. Both are the system's answers about
- // this window: a launch may put the same program in a
- // different layer or at a different page, so a program
- // cannot read either off its own description.
- layer: shown.layer,
-
- location: shown.location
+ // Which structurally isolated Desktop layer contains it.
+ layer: shown.layer
}]
}
@@ -1042,7 +1028,7 @@ export default function host(authManager: AuthManager, pane: string, desktop: ()
// One desktop can frame many Client layers, but its complete area is
// one host fact. It is this desktop's answer rather than a machine
// fact, and the gutter remains private desktop layout state.
- if (word === "desktopSurface") return [desktop()]
+ if (word === "desktopViewport") return [viewport()]
// Completed uploads are public values. Creating one has its own
// permission; exposing the native directory requires complete access.
diff --git a/source/client/view/components/program-frame.tsx b/source/client/view/components/program-frame.tsx
index be0d6a8..773850a 100644
--- a/source/client/view/components/program-frame.tsx
+++ b/source/client/view/components/program-frame.tsx
@@ -4,9 +4,9 @@ import { blockedProgramDocument, type ProgramAccess } from "./program-access"
import { type Theme } from "@phreshos/core"
import { type ReactEventHandler, useCallback } from "react"
-export function programFrameSource(assetId: string, client: ClientState, door: string) {
+export function programFrameSource(assetId: string, door: string) {
- return `${door}/${assetId}/assets/${client.window.location.slice(1)}`
+ return `${door}/${assetId}/assets/`
}
/** The document representation shared by every Client role. */
@@ -30,7 +30,7 @@ export default function ProgramFrame({ record, assetId, client, title, door, acc
style={{ colorScheme: theme }}
- src={programFrameSource(assetId, client, door)}
+ src={programFrameSource(assetId, door)}
title={title}
diff --git a/source/client/view/components/window-manager/local-windows.ts b/source/client/view/components/window-manager/local-windows.ts
index 4e40e70..da738f6 100644
--- a/source/client/view/components/window-manager/local-windows.ts
+++ b/source/client/view/components/window-manager/local-windows.ts
@@ -422,7 +422,6 @@ function localState(client: ClientState): LocalWindowState {
minimized: window.minimized,
front: false,
layer: window.layer,
- location: window.location,
depth: window.depth,
surface: null,
geometryAnimation: null,
@@ -440,7 +439,6 @@ function projectAuthoritative(local: LocalWindowState, client: ClientState, repl
size: window.size,
minimized: window.minimized,
layer: window.layer,
- location: window.location,
depth: window.depth,
geometryAnimation: replaceGeometry ? null : local.geometryAnimation,
minimizeAnimation: local.minimizeAnimation
@@ -456,7 +454,6 @@ function windowState(local: LocalWindowState, front: boolean, geometry?: Readonl
minimized: local.minimized,
front,
layer: local.layer,
- location: local.location
}
}
@@ -468,7 +465,7 @@ export type LocalGeometryReader = () => Readonly<{
function authoritativeSignature(client: ClientState) {
const window = client.window
- return JSON.stringify([window.title, window.position, window.size, window.minimized, window.layer, window.location, window.depth])
+ return JSON.stringify([window.title, window.position, window.size, window.minimized, window.layer, window.depth])
}
function frontmost(windows: ReadonlyMap<string, LocalWindowState>, layer: LocalWindowState["layer"]) {
diff --git a/source/client/view/structure/desktop/geometry.ts b/source/client/view/structure/desktop/geometry.ts
index 9ee3989..199735d 100644
--- a/source/client/view/structure/desktop/geometry.ts
+++ b/source/client/view/structure/desktop/geometry.ts
@@ -4,7 +4,7 @@ import { type CSSProperties } from "react"
* The gap between adjacent painted windows, in pixels. Each window uses
* half inside its own box; the ordinary workspace uses the other half
* at its boundary. The gutter remains private desktop layout state and never
- * enters the layer-independent Desktop surface snapshot.
+ * enters the layer-independent Desktop viewport snapshot.
*
* The visible window edge, taskbar edge and Start Menu geometry derive from
* this value rather than restating its pixel or rem equivalent.
diff --git a/source/client/view/structure/desktop/windows/process-window.tsx b/source/client/view/structure/desktop/windows/process-window.tsx
index f5d5923..dd20177 100644
--- a/source/client/view/structure/desktop/windows/process-window.tsx
+++ b/source/client/view/structure/desktop/windows/process-window.tsx
@@ -39,7 +39,7 @@ export default memo(function ({ identity, record, assetId, client, title, icon,
const represent = useCallback((reader: LocalGeometryReader | null) => onLocalRepresentation(record.identity, reader), [onLocalRepresentation, record])
- const frameSource = programFrameSource(assetId, client, door)
+ const frameSource = programFrameSource(assetId, door)
const [loading, setLoading] = useState<LoadingState>({ source: null, phase: "loading" })
diff --git a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
index 23e8eb3..9f0dee6 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/process-manager.ts
@@ -168,8 +168,7 @@ export default class ProcessManager extends TheLink {
size: window.size,
minimized: window.minimized,
front: this.front(window.layer) === process.identity,
- layer: window.layer,
- location: window.location
+ layer: window.layer
})
}
@@ -901,7 +900,7 @@ export default class ProcessManager extends TheLink {
private window(shape: Shape) {
- const shown = { title: shape.title, layer: shape.layer, location: shape.location }
+ const shown = { title: shape.title, layer: shape.layer }
return new Window(shown, shape.position, shape.size, ++this.highest, shape.minimize)
}
@@ -2140,14 +2139,6 @@ export default class ProcessManager extends TheLink {
return []
}
- // What a launch said, carried by the process it launched.
- if (word === "option") {
-
- const asked = this.system.holdProcess(rest[0], process)
-
- return [asked.options[String(rest[1])]]
- }
-
// A server SDK asks the host only where a Program's area begins;
// every filesystem operation belongs to the SDK after that. The
// area is shared by every Process, so the Program is named rather
@@ -2840,8 +2831,6 @@ interface ShapeBase {
size: Size
- location: string
-
minimize: boolean
}
diff --git a/source/server/core/link-manager/auth-manager/process-manager/process.ts b/source/server/core/link-manager/auth-manager/process-manager/process.ts
index d6f6b69..a2cd64a 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/process.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/process.ts
@@ -384,8 +384,6 @@ export interface ProcessLaunch {
layer: Layer
- location: string
-
minimize: boolean
service: boolean
diff --git a/source/server/core/link-manager/auth-manager/process-manager/window.ts b/source/server/core/link-manager/auth-manager/process-manager/window.ts
index 18023f3..1c0ab1d 100644
--- a/source/server/core/link-manager/auth-manager/process-manager/window.ts
+++ b/source/server/core/link-manager/auth-manager/process-manager/window.ts
@@ -19,18 +19,15 @@ import { isRelativeValue, type Position, type Size, type Value, type WindowGeome
* fields are gone: they existed to undo `maximize`, and filling the
* surface is a size like any other now.
*
- * **What is shown lives here, not on the process.** A title and
- * where the frame is filled from are all "how this is shown", the same
- * kind of fact as a size — and `client.size` already becomes
- * `window.size`, so `title` becomes `window.title` by the same road. A
- * process with no window needs none of them, and had to carry them all
- * while they sat on the process.
+ * **What is shown lives here, not on the process.** A title is "how this
+ * is shown", the same kind of fact as a size — and `client.size` already
+ * becomes `window.size`, so `title` becomes `window.title` by the same
+ * road. A process with no window needs none of them, and had to carry them
+ * all while they sat on the process.
*
* The title is the window's own from the moment it opens: born from what
* the client half declared, or the program's name when it declared
- * nothing, and changeable afterwards. A window showing one file of many
- * is the ordinary case, and a program that cannot say so has to put the
- * whole story in its own frame.
+ * nothing, and changeable afterwards.
*
* **Front is not kept here.** Which window is at the front is a fact about
* all of them at once — the un-minimized one with the greatest depth —
@@ -49,9 +46,6 @@ export interface Shown {
// Which structurally isolated Desktop layer this Window occupies.
layer: WindowLayer
- // Which page of the client half to open, beneath its declared root.
- // `/` is the root itself, so absence never has a second meaning.
- location: string
}
export default class Window {
@@ -74,17 +68,12 @@ export default class Window {
// The Window's authoritative Desktop layer.
public readonly layer: WindowLayer
- // Which of the half's own pages the frame opens on.
- public readonly location: string
-
public constructor(shown: Shown, position: Position, size: Size, depth: number, minimized: boolean) {
this.title = shown.title
this.layer = shown.layer
- this.location = shown.location
-
this.position = position
this.size = size
@@ -168,8 +157,6 @@ export default class Window {
layer: this.layer,
- location: this.location,
-
position: this.position,
size: this.size,
diff --git a/source/server/core/link-manager/auth-manager/program-manager/config.ts b/source/server/core/link-manager/auth-manager/program-manager/config.ts
index 99ede80..deb124a 100644
--- a/source/server/core/link-manager/auth-manager/program-manager/config.ts
+++ b/source/server/core/link-manager/auth-manager/program-manager/config.ts
@@ -90,11 +90,9 @@ export type ServerConfig = ServerConfigBase & ({
export interface ClientConfig {
// Where this half is: a directory holding index.html, or a URL.
- // Empty names the program's own root. For a URL, its last slash
- // ends the launch root and the remainder is the default location.
- // Not `path`, because a path cannot be a URL and this is one field
- // with both readings — which is what lets a program under
- // development be framed from a live dev server.
+ // Empty names the program's own root. Not `path`, because a path cannot
+ // be a URL; one field accepts both readings so a program under development
+ // can be framed from a live dev server.
location: string
// Whether a Process starts this endpoint by default. True when omitted.
diff --git a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
index 4249aa8..e957537 100644
--- a/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
+++ b/source/server/core/link-manager/auth-manager/program-manager/program-manager.ts
@@ -1445,8 +1445,6 @@ export default class ProgramManager extends TheLink {
if (asked.layer !== undefined && !layers.includes(asked.layer)) throw new Error(`A launch client's layer is one of ${layers.join(", ")}`)
- if (asked.location !== undefined && typeof asked.location !== "string") throw new Error("A launch client's location must be text")
-
if (asked.minimize !== undefined && typeof asked.minimize !== "boolean") throw new Error("A launch client's minimize state must be true or false")
const shift = this.authManager.processManager.processes.size % 8 * 32
@@ -1461,8 +1459,6 @@ export default class ProgramManager extends TheLink {
layer: asked.layer ?? client.layer ?? "window",
- location: page(asked.location, program.clientLocation),
-
minimize: asked.minimize ?? client.minimize ?? false
}
}
@@ -1478,26 +1474,6 @@ export default class ProgramManager extends TheLink {
export type ProgramManagerSnapshot = ReturnType<ProgramManager["toJSON"]>
-// Which of a half's own pages a launch asked for.
-//
-// A launch location is rooted in the client half's declared place,
-// whether that place is the program's assets or a URL directory. The
-// artificial prefix lets the URL parser normalise every spelling of a
-// path before the boundary is checked; what comes back is the client's
-// own location, always beginning at `/` and never naming its root.
-function page(said: string | undefined, fallback: string) {
-
- if (said === undefined) return fallback
-
- const root = "http://client.invalid/client/"
-
- const asked = new URL(said.replace(/^\/+/, ""), root)
-
- if (!asked.href.startsWith(root)) throw new Error("A client half's location cannot leave its declared root")
-
- return `/${asked.pathname.slice("/client/".length)}${asked.search}${asked.hash}`
-}
-
// What a launcher may say at the start. Named rather than ordered,
// because an order is invisible where it is written — and text, because
// an option must mean one thing however the process was started, and
diff --git a/source/server/core/link-manager/auth-manager/program-manager/program.ts b/source/server/core/link-manager/auth-manager/program-manager/program.ts
index e392c57..63a6fb9 100644
--- a/source/server/core/link-manager/auth-manager/program-manager/program.ts
+++ b/source/server/core/link-manager/auth-manager/program-manager/program.ts
@@ -131,17 +131,6 @@ export default class Program {
return location && /^https?:\/\//i.test(location) ? location : null
}
- public get clientLocation() {
-
- const location = this.clientUrl
-
- if (!location) return "/"
-
- const url = new URL(location)
-
- return `/${url.pathname.slice(url.pathname.lastIndexOf("/") + 1)}${url.search}${url.hash}`
- }
-
// The three places, resolved. A client that is a URL has no
// directory, and a half that was not declared has no place.
public get serverPath() {