preview: pretend homeserver for the dev preview (in-page, off by default) #28

Merged
void merged 9 commits from void/preview-demo into dev 2026-11-07 19:02:48 +00:00
Member

Makes the behind-login features usable on the dev preview with no server and no credentials.

  • src/preview-demo/: a pure in-memory Matrix handler (server.ts, fixtures in fixtures.ts) behind a guarded fetch (install.ts). Own-origin requests pass, https://demo.invalid is answered in-page, every other origin is refused (fetch, WebSocket, XHR, beacon).
  • Built in only with VITE_PREVIEW_DEMO=1 and switched on by previewDemo: true in config.json (scripts/preview-config.js low --demo, run by the dev workflow). A build without the flag contains none of it (checked by grep).
  • Login prefills demo (any password); a banner says pretend server. First visit turns the pose-portraits setting on.
  • Fixtures: General (training line), Ratatoskr (study), Huginn (show), a DM with Eureka, an unjoined public room. Messages carry org.gamecult.pose; a Mind answers whatever you send.
  • Pose art: 24 downscaled thumbnails (preview-demo/poses, ~200 KB) copied into dist by the workflow; the full art stays unsynced.
  • Tests: the real matrix-js-sdk logs in, syncs, sends and joins against the handler; the guard refuses foreign origins.

Public-safe fixtures: only the Minds and a fictional visitor.

🤖 Generated with Claude Code

Makes the behind-login features usable on the dev preview with no server and no credentials. - `src/preview-demo/`: a pure in-memory Matrix handler (`server.ts`, fixtures in `fixtures.ts`) behind a guarded `fetch` (`install.ts`). Own-origin requests pass, `https://demo.invalid` is answered in-page, every other origin is refused (fetch, WebSocket, XHR, beacon). - Built in only with `VITE_PREVIEW_DEMO=1` and switched on by `previewDemo: true` in config.json (`scripts/preview-config.js low --demo`, run by the dev workflow). A build without the flag contains none of it (checked by grep). - Login prefills `demo` (any password); a banner says `pretend server`. First visit turns the pose-portraits setting on. - Fixtures: General (training line), Ratatoskr (study), Huginn (show), a DM with Eureka, an unjoined public room. Messages carry `org.gamecult.pose`; a Mind answers whatever you send. - Pose art: 24 downscaled thumbnails (`preview-demo/poses`, ~200 KB) copied into dist by the workflow; the full art stays unsynced. - Tests: the real matrix-js-sdk logs in, syncs, sends and joins against the handler; the guard refuses foreign origins. Public-safe fixtures: only the Minds and a fictional visitor. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
src/preview-demo answers a demo.invalid homeserver from fixtures through a guarded fetch;
own-origin requests pass, every other origin is refused (fetch, WebSocket, XHR, beacon).
Built in only with VITE_PREVIEW_DEMO=1 and switched on by previewDemo in config.json
(scripts/preview-config.js --demo, run by the dev workflow). Login prefills 'demo'.
Pose art: 24 downscaled thumbnails in preview-demo/poses, copied into dist by the workflow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
preview-demo: destructure origin
Some checks failed
Build pull request / Build pull request (pull_request) Failing after 3m22s
e3278a4d7e
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The host CSP sandbox lacks allow-forms; Chrome drops native submission before the submit
event fires, so the login button did nothing in a real browser (found driving Chrome).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Found driving Chrome: the pose setting was seeded after settings.ts had already read defaults;
the Connecting bar stayed until the first 15 s long poll returned.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
preview-demo: fix test file, drop unused import
Some checks failed
Build pull request / Build pull request (pull_request) Failing after 2m53s
2a249ddf68
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
void merged commit d233344207 into dev 2026-11-07 19:02:48 +00:00
Author
Member

Provenance note on the pose thumbnails in this PR.

The 24 PNGs under preview-demo/poses/ (about 200 KB in total, 160 px wide, palette-quantised) are downscaled copies of GameCult's own Persona art from /opt/commons/cast-art/poses. That directory carries no provenance or licence note: the image model that made the art and the terms it was made under are not recorded. I committed them so the dev preview can show pose portraits; the full-size art stays unsynced and uncommitted.

Meta may veto. If so, strip them: delete preview-demo/poses/ and the Add the demo pose art step in .github/workflows/rat-dev-preview.yml. The demo then runs with broken portrait images (everything else is unaffected).

A README with the same text is in the follow-up PR onto dev.

🤖 Generated with Claude Code

Provenance note on the pose thumbnails in this PR. The 24 PNGs under `preview-demo/poses/` (about 200 KB in total, 160 px wide, palette-quantised) are downscaled copies of GameCult's own Persona art from `/opt/commons/cast-art/poses`. That directory carries no provenance or licence note: the image model that made the art and the terms it was made under are not recorded. I committed them so the dev preview can show pose portraits; the full-size art stays unsynced and uncommitted. Meta may veto. If so, strip them: delete `preview-demo/poses/` and the `Add the demo pose art` step in `.github/workflows/rat-dev-preview.yml`. The demo then runs with broken portrait images (everything else is unaffected). A README with the same text is in the follow-up PR onto `dev`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/Ratatoskr!28
No description provided.