Skip to content

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

A Client reads about from the System itself, when it started included; preferences take "desktop" and a numeric scale

zohayrslilehff938cce8779
diff --git a/source/client/core/link-manager/auth-manager/auth-manager.ts b/source/client/core/link-manager/auth-manager/auth-manager.ts
index c75bf61..ae8fb47 100644
--- a/source/client/core/link-manager/auth-manager/auth-manager.ts
+++ b/source/client/core/link-manager/auth-manager/auth-manager.ts
@@ -137,6 +137,12 @@ export default class AuthManager extends TheLink {
}
/** Opens one target for a Client, as that Client's Process. */
+ /** What the System is, and when it started, as the System itself says. */
+ public async about() {
+
+ return await this.$outbound.publishFirst("/about")
+ }
+
public async open(process: string, target: unknown) {
await this.$outbound.publishFirst("/opening/open", process, target)
diff --git a/source/client/view/appearance/desktop-preferences.tsx b/source/client/view/appearance/desktop-preferences.tsx
index 047aac0..a0742d4 100644
--- a/source/client/view/appearance/desktop-preferences.tsx
+++ b/source/client/view/appearance/desktop-preferences.tsx
@@ -6,7 +6,6 @@ import {
type AppearanceTransaction,
type DesktopPreferences,
type DesktopPreferencesUpdate,
- type DesktopScalePreference,
type Theme
} from "@phreshos/core"
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react"
@@ -39,21 +38,17 @@ export default function DesktopPreferencesProvider({ children }: Readonly<{ chil
const update = useCallback(function (change: DesktopPreferencesUpdate) {
if (change.theme !== undefined) {
- if (change.theme === "default") storedTheme.remove()
+ if (change.theme === "desktop") storedTheme.remove()
else storedTheme.update(change.theme)
}
if (change.animations !== undefined) {
- if (change.animations === "default") storedAnimations.remove()
+ if (change.animations === "desktop") storedAnimations.remove()
else storedAnimations.update(change.animations ? "enabled" : "disabled")
}
- if (change.scale !== undefined) {
- const stored = serializeDesktopScalePreference(change.scale)
- if (stored === null) storedScale.remove()
- else storedScale.update(stored)
- }
- }, [storedAnimations.remove, storedAnimations.update, storedScale.remove, storedScale.update, storedTheme.remove, storedTheme.update])
+ if (change.scale !== undefined) storedScale.update(String(change.scale))
+ }, [storedAnimations.remove, storedAnimations.update, storedScale.update, storedTheme.remove, storedTheme.update])
const setTransaction = useCallback(function (value: AppearanceTransaction) {
transaction.current = value
@@ -143,11 +138,6 @@ export function resolveStoredDesktopScale(value: string | null) {
return value !== null && Number.isFinite(scale) && scale >= minimum && scale <= maximum ? scale : defaultDesktopScale
}
-/** Converts a scale request into its persisted representation; null removes the override. */
-export function serializeDesktopScalePreference(value: DesktopScalePreference) {
- return value === "default" ? null : String(value)
-}
-
function useMediaPreference(query: string) {
const media = useMemo(() => matchMedia(query), [query])
return useSyncExternalStore(
diff --git a/source/client/view/components/desktop-host/host.ts b/source/client/view/components/desktop-host/host.ts
index 63a94fc..7eba6a7 100644
--- a/source/client/view/components/desktop-host/host.ts
+++ b/source/client/view/components/desktop-host/host.ts
@@ -1,5 +1,4 @@
import { planeSize } from "@client/view/components/window-manager/window-geometry"
-import { name, release, version } from "@/source/identity"
import {
type DesktopOffset,
type DesktopViewportState,
@@ -738,7 +737,7 @@ export default function host(authManager: AuthManager, pane: string, viewport: D
)]
}
- if (word === "about") return [Object.freeze({ name, version, release })]
+ if (word === "about") return [await authManager.about()]
if (word === "open") {
diff --git a/tests/client-permission-boundary.test.ts b/tests/client-permission-boundary.test.ts
index fd78562..47f2692 100644
--- a/tests/client-permission-boundary.test.ts
+++ b/tests/client-permission-boundary.test.ts
@@ -334,3 +334,11 @@ test("Reading the Desktop view is open, and moving it requires desktopViewport",
expect(move).toHaveBeenCalledWith({ x: 1200, y: 0 })
await expect(answer("moveDesktopViewport", { x: "far", y: 0 })).rejects.toThrow("finite x and y")
})
+
+test("a Client reads what the System is from the System itself, when it started included", async () => {
+ const about = Object.freeze({ name: "PhreshOS", version: "1.0.0", release: { name: "Sprout", program: "sprout" }, startedAt: new Date("2026-09-30T08:00:00.000Z") })
+ const auth = { about: vi.fn(async () => about) } as unknown as AuthManager
+ const answer = host(auth, "caller", { state: () => { throw new Error("unused viewport") }, move: () => { throw new Error("unused viewport") } }, () => null, clientFrame(), {} as never)
+
+ await expect(answer("about")).resolves.toEqual([about])
+})
diff --git a/tests/desktop-preferences.test.ts b/tests/desktop-preferences.test.ts
index e5e4f6b..6099296 100644
--- a/tests/desktop-preferences.test.ts
+++ b/tests/desktop-preferences.test.ts
@@ -1,6 +1,6 @@
import { defaultDesktopScale, desktopPreferencesLimits } from "@phreshos/core"
import { describe, expect, it } from "vitest"
-import { resolveStoredDesktopScale, serializeDesktopScalePreference } from "../source/client/view/appearance/desktop-preferences.js"
+import { resolveStoredDesktopScale } from "../source/client/view/appearance/desktop-preferences.js"
describe("Desktop preference persistence", () => {
it("resolves a stored scale within the contract bounds", () => {
@@ -12,9 +12,4 @@ describe("Desktop preference persistence", () => {
it.each([null, "", "0.49", "2.01", "not-a-number"])("uses the default for stored value %s", value => {
expect(resolveStoredDesktopScale(value)).toBe(defaultDesktopScale)
})
-
- it("stores direct values and removes the override for default", () => {
- expect(serializeDesktopScalePreference(1.25)).toBe("1.25")
- expect(serializeDesktopScalePreference("default")).toBeNull()
- })
})