Website: 16-bit pixel-art rebuild with a live Three.js office, downloads from Gitea v1.5.1
CI / Typecheck, lint, tests, e2e (push) Failing after 3m51s
CI / Typecheck, lint, tests, e2e (push) Failing after 3m51s
- Title screen over a real-time voxel office rendered at low resolution and quantized to a rotating 32-colour palette with Bayer dithering; day part and season re-light the scene and every surface. - 16-bit UI kit: name-plate dialogs, menu cursor, inventory, XP bar, badges, NPC speech, GAME OVER with CONTINUE, hand-placed 12x12 icons, Fusion Pixel font (Latin subset preloaded). - Sections as a game: quest log (onboarding), character select (AI CEO / AI Co-Founder), inventory (features), party roster (providers), live download XP, save point (all v1.5.1 builds), FAQ as NPC dialog, credits. - Downloads and source point to the Gitea release; the download function only redirects to git.zacharyzhang.com. - Tailwind and the old components removed; unit tests for platform/downloads, rewritten e2e suite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e374bc1e8e
commit
2d7af224dd
112 files changed
+5692
-4223
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import {
|
||||
DOWNLOAD_DEDUP_WINDOW_MS,
|
||||
downloadAssets,
|
||||
getDownloadAsset,
|
||||
getTrackedDownloadHref,
|
||||
isAllowedDownloadUrl,
|
||||
} from "../../lib/downloads";
|
||||
import { releaseVersion } from "../../lib/release-links";
|
||||
|
||||
test("lists every v1.5.1 build with unique ids", () => {
|
||||
assert.deepEqual(
|
||||
downloadAssets.map((asset) => asset.id),
|
||||
[
|
||||
"macos-arm64-dmg",
|
||||
"macos-arm64-zip",
|
||||
"macos-x64-dmg",
|
||||
"macos-x64-zip",
|
||||
"windows-x64-installer",
|
||||
"linux-x64-appimage",
|
||||
"linux-x64-deb",
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test("points every asset at the Gitea release for the current version", () => {
|
||||
for (const asset of downloadAssets) {
|
||||
assert.ok(isAllowedDownloadUrl(asset.href), asset.href);
|
||||
assert.ok(asset.href.endsWith(`/releases/download/v${releaseVersion}/${asset.fileName}`), asset.href);
|
||||
assert.match(asset.size, /^\d+ MB$/);
|
||||
}
|
||||
});
|
||||
|
||||
test("looks assets up by id and tracks downloads through the API", () => {
|
||||
assert.equal(getDownloadAsset("linux-x64-deb")?.platformId, "linux");
|
||||
assert.equal(getDownloadAsset("missing"), null);
|
||||
assert.equal(getTrackedDownloadHref("macos-arm64-dmg"), "/api/download?asset=macos-arm64-dmg");
|
||||
assert.equal(getTrackedDownloadHref("a b&c"), "/api/download?asset=a%20b%26c");
|
||||
assert.equal(DOWNLOAD_DEDUP_WINDOW_MS, 86_400_000);
|
||||
});
|
||||
|
||||
test("rejects download urls off the release host", () => {
|
||||
assert.equal(isAllowedDownloadUrl("https://evil.example/AgentCompany.dmg"), false);
|
||||
assert.equal(isAllowedDownloadUrl("http://git.zacharyzhang.com/x.dmg"), false);
|
||||
assert.equal(isAllowedDownloadUrl("https://git.zacharyzhang.com.evil.example/x.dmg"), false);
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { detectPlatform, recommendedAsset } from "../../lib/platform";
|
||||
|
||||
const UA = {
|
||||
mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0 Safari/537.36",
|
||||
windows: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0 Safari/537.36",
|
||||
linux: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0 Safari/537.36",
|
||||
linuxArm: "Mozilla/5.0 (X11; Linux aarch64; rv:131.0) Gecko/20100101 Firefox/131.0",
|
||||
android: "Mozilla/5.0 (Linux; Android 15; Pixel 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0 Mobile Safari/537.36",
|
||||
iphone: "Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1",
|
||||
};
|
||||
|
||||
test("detects desktop operating systems and architectures from the user agent", () => {
|
||||
assert.deepEqual(detectPlatform(UA.windows), { os: "windows", arch: "x64" });
|
||||
assert.deepEqual(detectPlatform(UA.linux), { os: "linux", arch: "x64" });
|
||||
assert.deepEqual(detectPlatform(UA.linuxArm), { os: "linux", arch: "arm64" });
|
||||
});
|
||||
|
||||
test("treats the Mac user agent's Intel claim as unknown and trusts client hints", () => {
|
||||
assert.deepEqual(detectPlatform(UA.mac), { os: "macos", arch: "unknown" });
|
||||
assert.deepEqual(detectPlatform(UA.mac, { platform: "macOS", architecture: "arm" }), { os: "macos", arch: "arm64" });
|
||||
assert.deepEqual(detectPlatform(UA.mac, { platform: "macOS", architecture: "x86" }), { os: "macos", arch: "x64" });
|
||||
});
|
||||
|
||||
test("reports phones as unknown even though their user agents mention Linux or Mac OS X", () => {
|
||||
assert.equal(detectPlatform(UA.android).os, "unknown");
|
||||
assert.equal(detectPlatform(UA.iphone).os, "unknown");
|
||||
});
|
||||
|
||||
test("recommends the matching installer for each platform", () => {
|
||||
assert.equal(recommendedAsset({ os: "macos", arch: "arm64" })?.id, "macos-arm64-dmg");
|
||||
assert.equal(recommendedAsset({ os: "macos", arch: "unknown" }), null);
|
||||
assert.equal(recommendedAsset({ os: "macos", arch: "x64" })?.id, "macos-x64-dmg");
|
||||
assert.equal(recommendedAsset({ os: "windows", arch: "x64" })?.id, "windows-x64-installer");
|
||||
assert.equal(recommendedAsset({ os: "windows", arch: "arm64" })?.id, "windows-x64-installer");
|
||||
assert.equal(recommendedAsset({ os: "linux", arch: "x64" })?.id, "linux-x64-appimage");
|
||||
assert.equal(recommendedAsset({ os: "linux", arch: "unknown" })?.id, "linux-x64-appimage");
|
||||
});
|
||||
|
||||
test("recommends nothing where no build exists", () => {
|
||||
assert.equal(recommendedAsset({ os: "linux", arch: "arm64" }), null);
|
||||
assert.equal(recommendedAsset({ os: "unknown", arch: "x64" }), null);
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { registerHooks } from "node:module";
|
||||
|
||||
// Lets Node's type stripping resolve the extensionless relative imports the Next.js bundler accepts.
|
||||
registerHooks({
|
||||
resolve(specifier, context, nextResolve) {
|
||||
try {
|
||||
return nextResolve(specifier, context);
|
||||
} catch (error) {
|
||||
if (error.code !== "ERR_MODULE_NOT_FOUND" || !specifier.startsWith(".")) throw error;
|
||||
return nextResolve(`${specifier}.ts`, context);
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user