The **API** lives in [server/](server/) (its README lists settings and routes): Fastify, SQLite via `node:sqlite` (loaded with `createRequire`, since Vite can't bundle it), bundles and covers stored by SHA-256 ([server/blobs.ts](server/blobs.ts)). It imports the game's own `readBundle` / `buildRegistry` / `defaultPack`, so a published pack passes exactly the checks the game runs; keep `src/content` free of browser-only code. Sessions are an opaque token in an HttpOnly cookie (hash stored); state-changing requests need the `x-fight-forge: 1` header. `npm run server` runs it (`DEV_LOGIN=1` allows sign-in by name for development); its tests (`server/app.test.ts`, `fastify.inject`, in-memory store) run with the rest. The client is [src/net/api.ts](src/net/api.ts): with no `VITE_API_URL`, `apiEnabled()` is false and online UI stays hidden. The Forge's pack page has [PublishTools](src/components/forge/PublishTools.tsx): sign in, choose visibility, publish the current version (a published version must be newer; it offers the next patch version). The start menu's BROWSE PACKS opens the **gallery** (`gameScreen: 'gallery'`, [src/components/Gallery.tsx](src/components/Gallery.tsx)): search, sort, a creator filter, and a pack page with Play (`fetchBundle`, cached per version in the Cache API since bundles are immutable, then `installBundle` and `startRun` at the pack's first own level) and a share link. `?pack=<id>` (`linkedPack()`) opens straight to that pack's page. **Remix in Forge** (`remixBundle` in workspace.ts) copies a published pack into the workspace under a new id (`<id>-remix`), version 1.0.0, with `meta.remixOf` crediting the original; the server links a published remix to its original (`remix_of`), and pack pages show "Remix of" and the list of remixes. Likes are one per user (`POST /packs/:id/like`, sort `likes`). The gallery marks packs updated since this browser last played them ([src/net/played.ts](src/net/played.ts), localStorage). **Moderation**: anyone signed in can ⚑ Report a pack; moderators (`ADMINS` setting, `provider:name`) get a Reports panel ([Moderation.tsx](src/components/Moderation.tsx)) to take a pack down, dismiss reports or ban its owner, each logged in `moderation_actions`, and Take down / Put back on pack pages. A taken-down pack, or any pack of a banned user, is visible only to its owner (marked in PublishTools) and admins. Owners can remove their pack from the server. Limits are server-side: publishes and reports per user per hour, and writes per IP. Bundles check models with `glbProblem` (a whole glTF 2.0 file with no outside URIs) and audio with `audioType`; tests build models with `tinyGlb` from [src/test/glb.ts](src/test/glb.ts).
0 commit comments