An open-source, self-hosted system for apps built with web technologies.
The System's wallpapers are uploads under kept keys, read from assets/wallpapers; the Desktop has no fallback of its own
zohayrslilehb5bfd113dc5a
diff --git a/assets/bundled/sprout-dark.webp b/assets/wallpapers/desktop-dark.webpsimilarity index 100%rename from assets/bundled/sprout-dark.webprename to assets/wallpapers/desktop-dark.webpdiff --git a/assets/bundled/sprout-light.webp b/assets/wallpapers/desktop-light.webpsimilarity index 100%rename from assets/bundled/sprout-light.webprename to assets/wallpapers/desktop-light.webpdiff --git a/assets/bundled/seed-dark.webp b/assets/wallpapers/sign-in-dark.webpsimilarity index 100%rename from assets/bundled/seed-dark.webprename to assets/wallpapers/sign-in-dark.webpdiff --git a/assets/bundled/seed-light.webp b/assets/wallpapers/sign-in-light.webpsimilarity index 100%rename from assets/bundled/seed-light.webprename to assets/wallpapers/sign-in-light.webpdiff --git a/source/client/view/structure/authentication/authentication.tsx b/source/client/view/structure/authentication/authentication.tsxindex 7dfadda..e25a901 100644--- a/source/client/view/structure/authentication/authentication.tsx+++ b/source/client/view/structure/authentication/authentication.tsx@@ -11,7 +11,6 @@ import { useEffect, useState, type ReactNode } from "react"import { type AuthenticationState } from "@server/core/authentication/authentication"import { WallpaperStage } from "../desktop/layers/wallpaper/wallpaper"import { useReady } from "@libs/readiness"-import { useThemedValue } from "@phreshos/react-ui"import { useProperty } from "@the-link/react"import { sessionRequirement, wallpaperRequirement } from "../readiness-requirements"@@ -23,8 +22,6 @@ export default function () {const appearance = useProperty(linkManager.appearance)- const signInWallpaper = useThemedValue(appearance.signInWallpaper)-const [revision, setRevision] = useState(0)useEffect(() => {@@ -87,9 +84,9 @@ export default function () {{sessionAuthenticate.solve.authentication.signedUp- ? <WallpaperStage place="signIn" file={signInWallpaper}><SignIn /></WallpaperStage>+ ? <WallpaperStage place="signIn" wallpaper={appearance.wallpaper}><SignIn /></WallpaperStage>- : <WallpaperStage place="signIn" file={signInWallpaper}>+ : <WallpaperStage place="signIn" wallpaper={appearance.wallpaper}><SignUp state={sessionAuthenticate.solve.authentication} onClosed={() => setRevision(value => value + 1)} />diff --git a/source/client/view/structure/desktop/desktop.tsx b/source/client/view/structure/desktop/desktop.tsxindex d4ec5d9..f6e5af4 100644--- a/source/client/view/structure/desktop/desktop.tsx+++ b/source/client/view/structure/desktop/desktop.tsx@@ -36,8 +36,6 @@ export default function Workspace() {const appearance = useProperty(LinkManagerContext.useValue().appearance)- const desktopWallpaper = useThemedValue(appearance.desktopWallpaper)-const foreground = useThemedValue(appearance.colors).foregroundconst { theme } = usePreferences()@@ -542,7 +540,7 @@ export default function Workspace() {const wallpaper = hasWallpaperClient? renderWindows("wallpaper")- : <WallpaperBackground place="desktop" file={desktopWallpaper} onReady={fileWallpaperLoaded} />+ : <WallpaperBackground place="desktop" wallpaper={appearance.wallpaper} onReady={fileWallpaperLoaded} />const shell = hasShellClient? renderWindows("shell")diff --git a/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsx b/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsxindex 0a59ff8..bf020a7 100644--- a/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsx+++ b/source/client/view/structure/desktop/layers/wallpaper/wallpaper.tsx@@ -1,7 +1,3 @@-import seedDark from "@/assets/bundled/seed-dark.webp"-import seedLight from "@/assets/bundled/seed-light.webp"-import sproutDark from "@/assets/bundled/sprout-dark.webp"-import sproutLight from "@/assets/bundled/sprout-light.webp"import { ApplicationContext } from "@client/view/contexts"import { useEffect, useEffectEvent, useRef, useState, type ReactNode, type TransitionEvent } from "react"import Loading from "@client/view/components/loading"@@ -9,20 +5,11 @@ import { useReady } from "@libs/readiness"import { wallpaperRequirement } from "../../../readiness-requirements"import { usePreferences, useTiming } from "@phreshos/react-ui"import { useReducedMotion } from "@libs/react-motion"-import { cssEasing } from "@phreshos/core"+import { cssEasing, type AppearanceWallpaper, type ThemedValue } from "@phreshos/core"import { wallpaperKind, type WallpaperKind } from "@shared/wallpaper"/** Where a wallpaper is shown. */-export type WallpaperPlace = "signIn" | "desktop"--/**- * What each place shows until its owner chooses a wallpaper: the seed before you sign in, and the- * release's own wallpaper once you are in. Both follow the theme.- */-const bundledWallpapers: Readonly<Record<WallpaperPlace, Readonly<Record<"light" | "dark", string>>>> = {- signIn: { light: seedLight, dark: seedDark },- desktop: { light: sproutLight, dark: sproutDark }-}+export type WallpaperPlace = keyof AppearanceWallpapertype WallpaperSource = Readonly<{identity: string@@ -37,11 +24,12 @@ type WallpaperLayers = Readonly<{}>/** Displays one completely loaded wallpaper source. */-export function WallpaperBackground({ place, file, onReady }: WallpaperBackgroundProps) {+export function WallpaperBackground({ place, wallpaper, onReady }: WallpaperBackgroundProps) {const application = ApplicationContext.useValue()const { theme } = usePreferences()const reducedMotion = useReducedMotion()- const desired = resolveWallpaper(place, file, theme, application.doors.uploads)+ const desired = resolveWallpaper(wallpaper[theme][place], application.doors.uploads)+ const other = resolveWallpaper(wallpaper[theme === "light" ? "dark" : "light"][place], application.doors.uploads)const [layers, setLayers] = useState<WallpaperLayers>({displayed: null,incoming: desired,@@ -55,12 +43,11 @@ export function WallpaperBackground({ place, file, onReady }: WallpaperBackgrounconst ready = useEffectEvent(() => onReady?.())useEffect(() => {- // Both themes of this place's default, so a change of theme shows at once.- for (const wallpaper of Object.values(bundledWallpapers[place])) {- const image = new Image()- image.src = wallpaper- }- }, [place])+ // The other theme's picture too, so a change of theme shows at once.+ if (other.kind !== "image") return+ const image = new Image()+ image.src = other.url+ }, [other.url, other.kind])useEffect(() => {cancelSwitch(frame)@@ -189,9 +176,7 @@ function WallpaperLayer({ source, visible, onLoad, onError, onTransitionEnd }: R</div>}-function resolveWallpaper(place: WallpaperPlace, file: string | null, theme: "light" | "dark", uploads: string): WallpaperSource {- if (file === null) return { identity: `bundled:${place}:${theme}`, kind: "image", url: bundledWallpapers[place][theme] }-+function resolveWallpaper(file: string, uploads: string): WallpaperSource {const kind = wallpaperKind(file) ?? "image"const path = kind === "html" ? `${uploads}/wallpaper/${encodeURIComponent(file)}` : `${uploads}/${encodeURIComponent(file)}`@@ -206,12 +191,14 @@ function cancelSwitch(frame: { current: number | null }) {}/** A complete surface whose content sits above one file-backed wallpaper. */-export function WallpaperStage({ place, file, children }: WallpaperStageProps) {- const [readyFile, setReadyFile] = useState<string | null>()+export function WallpaperStage({ place, wallpaper, children }: WallpaperStageProps) {+ const { theme } = usePreferences()+ const file = wallpaper[theme][place]+ const [readyFile, setReadyFile] = useState<string>()const ready = readyFile === filereturn <div className="relative isolate grid min-h-0">- <WallpaperBackground place={place} file={file} onReady={() => setReadyFile(file)} />+ <WallpaperBackground place={place} wallpaper={wallpaper} onReady={() => setReadyFile(file)} /><div className="pointer-events-none relative z-1 grid min-h-0">{children}@@ -230,12 +217,12 @@ export function ReadyWallpaper() {interface WallpaperStageProps {place: WallpaperPlace- file: string | null+ wallpaper: ThemedValue<AppearanceWallpaper>children: ReactNode}interface WallpaperBackgroundProps {place: WallpaperPlace- file: string | null+ wallpaper: ThemedValue<AppearanceWallpaper>onReady?: () => void}diff --git a/source/server/core/appearance-manager.ts b/source/server/core/appearance-manager.tsindex 1958e3b..6e1212c 100644--- a/source/server/core/appearance-manager.ts+++ b/source/server/core/appearance-manager.ts@@ -1,11 +1,10 @@import Keyv from "keyv"import { isDeepStrictEqual } from "node:util"-import { applyAppearanceUpdate, defaultAppearance, type Appearance } from "@phreshos/core"+import { applyAppearanceUpdate, defaultAppearance, isUploadFile, type Appearance } from "@phreshos/core"import UploadManager from "./upload-manager"import { wallpaperKind, wallpaperSizeLimit } from "@shared/wallpaper"const storageKey = "appearance"-const servedFile = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.[a-z0-9]+$//** Durable, complete Appearance state owned by Server Core. */export default class AppearanceManager {@@ -35,10 +34,10 @@ export default class AppearanceManager {public async update(value: unknown) {const appearance = applyAppearanceUpdate(this.current, value)- this.validateWallpaper(appearance.signInWallpaper.light)- this.validateWallpaper(appearance.signInWallpaper.dark)- this.validateWallpaper(appearance.desktopWallpaper.light)- this.validateWallpaper(appearance.desktopWallpaper.dark)+ for (const wallpaper of [appearance.wallpaper.light, appearance.wallpaper.dark]) {+ this.validateWallpaper(wallpaper.signIn)+ this.validateWallpaper(wallpaper.desktop)+ }if (isDeepStrictEqual(this.current, appearance)) return this.current@@ -48,9 +47,8 @@ export default class AppearanceManager {return appearance}- private validateWallpaper(file: string | null) {- if (file === null) return- if (!servedFile.test(file)) throw new Error("A wallpaper must be a system upload")+ private validateWallpaper(file: string) {+ if (!isUploadFile(file)) throw new Error("A wallpaper must be a system upload")const upload = this.uploads.stat(file)diff --git a/source/server/core/application.ts b/source/server/core/application.tsindex 3dc61f5..c6e6b2b 100644--- a/source/server/core/application.ts+++ b/source/server/core/application.ts@@ -66,7 +66,8 @@ export default class Application {this.system = new System(this)}- public static async initialize(homePath: string, icons: ApplicationIcons) {+ /** `wallpapers` is the directory of the wallpapers the System comes with, named by their upload keys. */+ public static async initialize(homePath: string, icons: ApplicationIcons, wallpapers: string) {const storage = new FileManager(homePath)@@ -76,7 +77,7 @@ export default class Application {const authentication = await Authentication.open(storage.join("credentials.json"), store)- const uploads = new UploadManager(storage.navigateTo("uploads"))+ const uploads = new UploadManager(storage.navigateTo("uploads"), wallpapers)const appearanceManager = await AppearanceManager.open(store, uploads)diff --git a/source/server/core/upload-manager.ts b/source/server/core/upload-manager.tsindex 1ecfe2c..335aac6 100644--- a/source/server/core/upload-manager.ts+++ b/source/server/core/upload-manager.ts@@ -5,7 +5,8 @@ import { randomUUID } from "node:crypto"import { Readable } from "node:stream"import { pipeline } from "node:stream/promises"import { type ReadableStream as NodeReadableStream } from "node:stream/web"-import { isUploadFile, type FileStat } from "@phreshos/core"+import { join } from "node:path"+import { isSystemUploadFile, isUploadFile, type FileStat } from "@phreshos/core"export const uploadLimit = 1024 * 1024 * 1024@@ -32,12 +33,15 @@ export class UploadTooLargeError extends Error {* Incoming bytes are written beside their destination under a hidden name.* Only a complete value at or below the limit is renamed into public reach;* interruption and refusal remove the temporary file.+ *+ * The keys the System keeps for its own wallpapers read the files it comes+ * with instead, so each release shows its own pictures behind them.*/export default class UploadManager {public readonly fileManager: FileManager- public constructor(fileManager: FileManager) {+ public constructor(fileManager: FileManager, public readonly systemPath: string) {this.fileManager = fileManager@@ -48,7 +52,7 @@ export default class UploadManager {if (!isUploadFile(file)) throw new Error("That is not an upload file")- return this.fileManager.join(file)+ return isSystemUploadFile(file) ? join(this.systemPath, file) : this.fileManager.join(file)}public async write(extension: string, content: ReadableStream<Uint8Array> | null, signal?: AbortSignal) {diff --git a/source/server/view/http/uploads.ts b/source/server/view/http/uploads.tsindex 55762bd..baa90e2 100644--- a/source/server/view/http/uploads.ts+++ b/source/server/view/http/uploads.ts@@ -3,12 +3,15 @@ import { MissingUploadValueError, UploadTooLargeError, uploadLimit } from "@servimport Application from "@server/core/application"import doors from "./doors"import { Hono } from "hono"-import { isUploadFile } from "@phreshos/core"+import { isSystemUploadFile, isUploadFile } from "@phreshos/core"import { readFile } from "node:fs/promises"import { wallpaperKind, wallpaperSizeLimit } from "@shared/wallpaper"const immutableCache = "public, max-age=31536000, immutable"+// The System's own files keep their keys while a release replaces them, so a browser asks again.+const systemCache = "no-cache"+const wallpaperPolicy = ["default-src 'none'","script-src 'unsafe-inline' data: blob:",@@ -95,7 +98,7 @@ export default function (application: Application) {if (!upload) return context.body(null, 404)- context.header("Cache-Control", immutableCache)+ context.header("Cache-Control", isSystemUploadFile(context.req.param("file")) ? systemCache : immutableCache)return context.json(upload)}@@ -149,16 +152,15 @@ export default function (application: Application) {await next()- context.header("Cache-Control", immutableCache)+ context.header("Cache-Control", isSystemUploadFile(file) ? systemCache : immutableCache)context.header("Access-Control-Allow-Origin", "*")})- uploads.use("/:file", serveStatic({+ const uploaded = serveStatic({ root: application.uploads.fileManager.path, rewriteRequestPath: path => path.slice(doors.uploads.length + 1) })- root: application.uploads.fileManager.path,+ const kept = serveStatic({ root: application.uploads.systemPath, rewriteRequestPath: path => path.slice(doors.uploads.length + 1) })- rewriteRequestPath: path => path.slice(doors.uploads.length + 1)- }))+ uploads.use("/:file", (context, next) => (isSystemUploadFile(context.req.param("file")) ? kept : uploaded)(context, next))return uploads}diff --git a/source/server/view/view.ts b/source/server/view/view.tsindex 1ed6846..990caa9 100644--- a/source/server/view/view.ts+++ b/source/server/view/view.ts@@ -29,7 +29,7 @@ export default async function (config: Config) {font: "simple"})- const application = await Application.initialize(config.home, { system: resolve("assets/logo.png"), defaultProgram: resolve("assets/default-icon.png") })+ const application = await Application.initialize(config.home, { system: resolve("assets/logo.png"), defaultProgram: resolve("assets/default-icon.png") }, resolve("assets/wallpapers"))// One server, five doors, each at its own name. A program's client// is still not the API — it is files a browser reads, with no link,diff --git a/tests/appearance.test.ts b/tests/appearance.test.tsindex dcdf186..bac97a5 100644--- a/tests/appearance.test.ts+++ b/tests/appearance.test.ts@@ -1,12 +1,12 @@import assert from "node:assert/strict"import Keyv from "keyv"-import { defaultAppearance, parseAppearance } from "@phreshos/core"+import { defaultAppearance, parseAppearance, systemWallpapers } from "@phreshos/core"import AppearanceManager from "@server/core/appearance-manager"import FileManager from "@libs/file-manager"import UploadManager from "@server/core/upload-manager"import { mkdtemp, rm, truncate, writeFile } from "node:fs/promises"import { tmpdir } from "node:os"-import { join } from "node:path"+import { join, resolve } from "node:path"import { test } from "vitest"import { randomUUID } from "node:crypto"import { wallpaperSizeLimit } from "@shared/wallpaper"@@ -33,7 +33,7 @@ test("appearance contract", async () => {const store = new Keyv()const directory = await mkdtemp(join(tmpdir(), "phresh-appearance-"))- const uploads = new UploadManager(new FileManager(directory))+ const uploads = new UploadManager(new FileManager(directory), resolve("assets/wallpapers"))const manager = await AppearanceManager.open(store, uploads)assert.deepEqual(manager.value, defaultAppearance)@@ -124,17 +124,24 @@ test("appearance contract", async () => {uploads.write(extension, new Blob(["wallpaper"]).stream())))for (const file of wallpaperFiles) {- await manager.update({- ...manager.value,- desktopWallpaper: { ...manager.value.desktopWallpaper, light: file }- })- assert.equal(manager.value.desktopWallpaper.light, file)+ await manager.update({ wallpaper: { light: { desktop: file } } })+ assert.equal(manager.value.wallpaper.light.desktop, file)+ assert.equal(manager.value.wallpaper.light.signIn, systemWallpapers.light.signIn)}+ // The System's own wallpapers are uploads it keeps, each read from the files it comes with.+ for (const wallpaper of Object.values(systemWallpapers)) for (const file of Object.values(wallpaper)) {+ assert(uploads.stat(file)!.size > 0)+ }+ await manager.update({ wallpaper: { light: { desktop: systemWallpapers.dark.desktop } } })+ assert.equal(manager.value.wallpaper.light.desktop, systemWallpapers.dark.desktop)+ await assert.rejects(manager.update({ wallpaper: { light: { desktop: null } } }))+ await assert.rejects(manager.update({ wallpaper: { light: { desktop: `${randomUUID()}.png` } } }), /does not exist/)+const unsupported = await uploads.write("txt", new Blob(["wallpaper"]).stream())await assert.rejects(manager.update({...manager.value,- desktopWallpaper: { ...manager.value.desktopWallpaper, light: unsupported }+ wallpaper: { ...manager.value.wallpaper, light: { ...manager.value.wallpaper.light, desktop: unsupported } }}), /image, video, or HTML/)const oversized = `${randomUUID()}.html`@@ -142,7 +149,7 @@ test("appearance contract", async () => {await truncate(uploads.path(oversized), wallpaperSizeLimit + 1)await assert.rejects(manager.update({...manager.value,- desktopWallpaper: { ...manager.value.desktopWallpaper, light: oversized }+ wallpaper: { ...manager.value.wallpaper, light: { ...manager.value.wallpaper.light, desktop: oversized } }}), /50 MiB/)await rm(directory, { recursive: true, force: true })diff --git a/tests/authentication-domains.test.ts b/tests/authentication-domains.test.tsindex 0702b38..18ca8e9 100644--- a/tests/authentication-domains.test.ts+++ b/tests/authentication-domains.test.ts@@ -9,7 +9,8 @@ test("browser Connections and Sessions form one authoritative lifecycle", asyncconst home = await mkdtemp(join(tmpdir(), "phreshos-authentication-"))const application = await Application.initialize(home,- { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") }+ { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") },+ join(home, "wallpapers"))const link = new TheLink()const connection = application.linkManager.addConnection(link, "Chrome on macOS")diff --git a/tests/link-request-routing.test.ts b/tests/link-request-routing.test.tsindex 63e70d3..eec5fa0 100644--- a/tests/link-request-routing.test.ts+++ b/tests/link-request-routing.test.ts@@ -11,7 +11,7 @@ import { test } from "vitest"test("an RPC result returns only to its requesting boundary", async () => {const home = await mkdtemp(join(tmpdir(), "phreshos-request-routing-"))- const application = await Application.initialize(home, { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") })+ const application = await Application.initialize(home, { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") }, join(home, "wallpapers"))const link = new TheLink()const boundary = application.linkManager.addExternalConnection(link)const broadcasts: unknown[][] = []diff --git a/tests/system-about.test.ts b/tests/system-about.test.tsindex 561f5a9..e02ed56 100644--- a/tests/system-about.test.ts+++ b/tests/system-about.test.ts@@ -9,7 +9,7 @@ import { name, release, version } from "@/source/identity"test("the System says what it is from its identity, and when it started", async () => {const home = await mkdtemp(join(tmpdir(), "phreshos-about-"))const before = Date.now()- const application = await Application.initialize(home, { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") })+ const application = await Application.initialize(home, { system: join(home, "logo.png"), defaultProgram: join(home, "icon.png") }, join(home, "wallpapers"))try {const about = application.system.about()diff --git a/tests/system-icon.test.ts b/tests/system-icon.test.tsindex a3fce93..daea9b6 100644--- a/tests/system-icon.test.ts+++ b/tests/system-icon.test.ts@@ -8,7 +8,7 @@ import Application from "@server/core/application"test("the System renders its own icon at each standard size, and only those", async () => {const home = await mkdtemp(join(tmpdir(), "phreshos-icon-"))- const application = await Application.initialize(home, { system: resolve("assets/logo.png"), defaultProgram: resolve("assets/default-icon.png") })+ const application = await Application.initialize(home, { system: resolve("assets/logo.png"), defaultProgram: resolve("assets/default-icon.png") }, resolve("assets/wallpapers"))try {for (const [size, length] of [["small", 32], ["medium", 64], ["large", 128]] as const) {const metadata = await sharp(Buffer.from(await application.system.icon(size))).metadata()diff --git a/tests/uploads.test.ts b/tests/uploads.test.tsindex ed1dc30..0e180e6 100644--- a/tests/uploads.test.ts+++ b/tests/uploads.test.ts@@ -3,6 +3,7 @@ import { mkdtemp, readFile, rm } from "node:fs/promises"import { resolve } from "node:path"import FileManager from "@libs/file-manager"import UploadManager from "@server/core/upload-manager"+import { systemWallpapers } from "@phreshos/core"import uploadView from "@server/view/http/uploads"import type Application from "@server/core/application"import { Hono } from "hono"@@ -10,7 +11,7 @@ import { test } from "vitest"test("uploads contract", async () => {const directory = await mkdtemp(resolve(".verify-uploads-"))- const uploads = new UploadManager(new FileManager(directory))+ const uploads = new UploadManager(new FileManager(directory), resolve("assets/wallpapers"))try {const file = await uploads.write("txt", new Blob(["hello uploads"]).stream())@@ -81,6 +82,13 @@ test("uploads contract", async () => {assert.match(wallpaper.headers.get("content-security-policy") ?? "", /sandbox allow-scripts/)assert.equal(await wallpaper.text(), htmlSource)assert.equal((await view.request(`http://system/uploads/wallpaper/${created.file}`)).status, 400)++ // A key the System keeps reads the file it comes with, asked for again after a release.+ const kept = await view.request(`http://system/uploads/${systemWallpapers.light.desktop}`)+ assert.equal(kept.status, 200)+ assert.equal(kept.headers.get("cache-control"), "no-cache")+ assert.deepEqual(new Uint8Array(await kept.arrayBuffer()), new Uint8Array(await readFile(resolve("assets/wallpapers", systemWallpapers.light.desktop))))+ assert.equal(uploads.stat(systemWallpapers.dark.signIn)?.size, (await readFile(resolve("assets/wallpapers", systemWallpapers.dark.signIn))).byteLength)assert.equal((await view.request("http://system/uploads/not-a-key")).status, 400)assert.equal((await view.request("http://system/uploads/00000000-0000-0000-0000-000000000000.txt")).status, 404)} finally {diff --git a/tests/wallpaper-source.test.tsx b/tests/wallpaper-source.test.tsxindex 9f7d690..13c04d7 100644--- a/tests/wallpaper-source.test.tsx+++ b/tests/wallpaper-source.test.tsx@@ -1,7 +1,7 @@import assert from "node:assert/strict"import { renderToStaticMarkup } from "react-dom/server"import { UIProvider } from "@phreshos/react-ui"-import { defaultAppearance } from "@phreshos/core"+import { defaultAppearance, systemWallpapers } from "@phreshos/core"import { ApplicationContext } from "@client/view/contexts"import Application from "@client/core/application"import { WallpaperBackground, type WallpaperPlace } from "@client/view/structure/desktop/layers/wallpaper/wallpaper"@@ -16,17 +16,18 @@ test("wallpaper source contract", () => {program: "/program"})- function render(file: string | null, place: WallpaperPlace = "desktop") {+ function render(file: string, place: WallpaperPlace = "desktop") {+ const wallpaper = { ...systemWallpapers, dark: { ...systemWallpapers.dark, [place]: file } }return renderToStaticMarkup(<ApplicationContext.Provider value={application}><UIProvider appearance={defaultAppearance} preferences={{ theme: "dark", animations: true }}>- <WallpaperBackground place={place} file={file} />+ <WallpaperBackground place={place} wallpaper={wallpaper} /></UIProvider></ApplicationContext.Provider>)}- // Without a chosen wallpaper, the sign-in screen shows the seed and the Desktop the release's own.- assert.match(render(null, "signIn"), /seed-dark/)- assert.match(render(null, "desktop"), /sprout-dark/)+ // The System's own wallpapers are uploads like any other, each shown in its own place.+ assert.match(render(systemWallpapers.dark.signIn, "signIn"), /src="\/uploads\/sign-in-dark\.webp"/)+ assert.match(render(systemWallpapers.dark.desktop), /src="\/uploads\/desktop-dark\.webp"/)const image = render("00000000-0000-0000-0000-000000000000.png")assert.match(image, /<img/)