Skip to content

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

Wallpaper files keep kebab-case names; only their keys are SCREAMING_SNAKE_CASE

zohayrslilehc30fd8bc9e94
diff --git a/assets/wallpapers/DESKTOP_DARK_WALLPAPER.webp b/assets/wallpapers/desktop-dark.webp
similarity index 100%
rename from assets/wallpapers/DESKTOP_DARK_WALLPAPER.webp
rename to assets/wallpapers/desktop-dark.webp
diff --git a/assets/wallpapers/DESKTOP_LIGHT_WALLPAPER.webp b/assets/wallpapers/desktop-light.webp
similarity index 100%
rename from assets/wallpapers/DESKTOP_LIGHT_WALLPAPER.webp
rename to assets/wallpapers/desktop-light.webp
diff --git a/assets/wallpapers/SIGN_IN_DARK_WALLPAPER.webp b/assets/wallpapers/sign-in-dark.webp
similarity index 100%
rename from assets/wallpapers/SIGN_IN_DARK_WALLPAPER.webp
rename to assets/wallpapers/sign-in-dark.webp
diff --git a/assets/wallpapers/SIGN_IN_LIGHT_WALLPAPER.webp b/assets/wallpapers/sign-in-light.webp
similarity index 100%
rename from assets/wallpapers/SIGN_IN_LIGHT_WALLPAPER.webp
rename to assets/wallpapers/sign-in-light.webp
diff --git a/source/server/view/view.ts b/source/server/view/view.ts
index e6bfe9a..d7335e5 100644
--- a/source/server/view/view.ts
+++ b/source/server/view/view.ts
@@ -17,10 +17,10 @@ import { join } from "node:path"
import { systemWallpapers } from "@phreshos/core"
import logo from "@/assets/logo.png?url"
import defaultIcon from "@/assets/default-icon.png?url"
-import signInLightWallpaper from "@/assets/wallpapers/SIGN_IN_LIGHT_WALLPAPER.webp?url"
-import signInDarkWallpaper from "@/assets/wallpapers/SIGN_IN_DARK_WALLPAPER.webp?url"
-import desktopLightWallpaper from "@/assets/wallpapers/DESKTOP_LIGHT_WALLPAPER.webp?url"
-import desktopDarkWallpaper from "@/assets/wallpapers/DESKTOP_DARK_WALLPAPER.webp?url"
+import signInLightWallpaper from "@/assets/wallpapers/sign-in-light.webp?url"
+import signInDarkWallpaper from "@/assets/wallpapers/sign-in-dark.webp?url"
+import desktopLightWallpaper from "@/assets/wallpapers/desktop-light.webp?url"
+import desktopDarkWallpaper from "@/assets/wallpapers/desktop-dark.webp?url"
import { writeFile } from "node:fs/promises"
import { styleText } from "node:util"
import { listenOnPorts } from "./configuration"
diff --git a/tests/distribution.test.mjs b/tests/distribution.test.mjs
index cdb1d9b..a1cdbf5 100644
--- a/tests/distribution.test.mjs
+++ b/tests/distribution.test.mjs
@@ -49,7 +49,7 @@ test("distribution contract", async () => {
}
// The files the server reads travel inside its build, under content-hashed names.
- for (const name of ["logo", "default-icon", "SIGN_IN_LIGHT_WALLPAPER", "SIGN_IN_DARK_WALLPAPER", "DESKTOP_LIGHT_WALLPAPER", "DESKTOP_DARK_WALLPAPER"]) {
+ for (const name of ["logo", "default-icon", "sign-in-light", "sign-in-dark", "desktop-light", "desktop-dark"]) {
assert([...paths].some(path => path.startsWith(`server/assets/${name}-`)), `the server build carries no ${name}`)
}
diff --git a/tests/system-files.ts b/tests/system-files.ts
index 4c9f6cf..896fe4f 100644
--- a/tests/system-files.ts
+++ b/tests/system-files.ts
@@ -2,6 +2,9 @@ import { resolve } from "node:path"
import { systemWallpapers } from "@phreshos/core"
/** The files behind the upload keys the System keeps, read from the sources as a build carries them. */
-export const systemFiles = Object.fromEntries(Object.values(systemWallpapers)
- .flatMap(wallpapers => Object.values(wallpapers))
- .map(key => [key, resolve(`assets/wallpapers/${key}.webp`)]))
+export const systemFiles = {
+ [systemWallpapers.light.signIn]: resolve("assets/wallpapers/sign-in-light.webp"),
+ [systemWallpapers.dark.signIn]: resolve("assets/wallpapers/sign-in-dark.webp"),
+ [systemWallpapers.light.desktop]: resolve("assets/wallpapers/desktop-light.webp"),
+ [systemWallpapers.dark.desktop]: resolve("assets/wallpapers/desktop-dark.webp")
+}
diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts
index d0f66a2..77bb4d3 100644
--- a/tests/uploads.test.ts
+++ b/tests/uploads.test.ts
@@ -90,7 +90,7 @@ test("uploads contract", async () => {
assert.equal(kept.headers.get("cache-control"), "no-cache")
assert.equal(kept.headers.get("content-type"), "image/webp")
assert.deepEqual(new Uint8Array(await kept.arrayBuffer()), new Uint8Array(await readFile(uploads.path(systemWallpapers.light.desktop))))
- assert.equal(uploads.stat(systemWallpapers.dark.signIn)?.size, (await readFile(resolve("assets/wallpapers/SIGN_IN_DARK_WALLPAPER.webp"))).byteLength)
+ assert.equal(uploads.stat(systemWallpapers.dark.signIn)?.size, (await readFile(resolve("assets/wallpapers/sign-in-dark.webp"))).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 {