Files
VoxVera/AGENTS.md
T
thePR0M3TH3ANandClaude Opus 4.8 127f9c3134 Locale-aware defaults: browser language list + US Letter/A4 paper size
Language inference:
- Walk navigator.languages (the full ordered preference list), not just
  navigator.language, and pick the first base language we support. A user who
  prefers e.g. Dutch then German now gets German instead of the English
  fallback. De-duplicates the default-language resolution into setDefaultText.

Paper size (US Letter + A4):
- Add A4 (210x297mm) alongside US Letter (8.5x11in). Sheet dimensions move to
  CSS custom properties (--sheet-w/--sheet-h) toggled by a paper-letter/paper-a4
  class on <html>; the tear-off column and QR codes stay fixed physical sizes
  and the content column flexes.
- @page size is injected by JS (id voxvera-page-size) since @page cannot read
  CSS variables across engines; the print block keeps margin:0 and a Letter
  default for the pre-JS state.
- Default paper is chosen from the browser locale's region subtag
  (en-US -> Letter, en-GB/de-DE -> A4) — "by location" without geolocation,
  falling back to Letter when no region is present. A manual override selector
  (topbar + viewer controls) persists in localStorage and wins over the default.
- Paper size is a local print/view preference and is never written into the
  Nostr event, so a flyer reprints on either size unchanged.
- Add paper_size/paper_letter/paper_a4 labels for all 14 languages.

Docs + tests:
- Spec gains a "Print paper size" section; AGENTS.md records the
  not-in-payload invariant; README adds a feature bullet; the field-limits
  cheat sheet gains Letter/A4 columns (re-measured per paper size).
- Playwright: add tests for navigator.languages inference, region-based paper
  default (A4 and Letter), and override persistence. 54 tests pass across
  Chromium, Firefox, WebKit, and Android/iOS mobile emulations.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-09 15:56:25 -04:00

2.3 KiB

AI Agent Instructions For VoxVera

main is the Nostr static-client branch. The old Tor/OnionShare CLI application is preserved on legacy-tor.

Current Architecture

  • Active frontend: site/ (index.html, nostr-client.js, nostr-client.css, locales.js)
  • Static deployment root: site
  • Browser dependencies: vendored under site/vendor/
  • Legacy path: site/nostr/index.html is a redirect stub forwarding old /nostr/ poster URLs and QR codes to the root
  • Python helper package: voxvera/nostr/
  • Design plan: docs/nostr-static-client-spec.md

Guardrails

  • Do not reintroduce the legacy Tor CLI, OnionShare runtime, installer, Electron manager, bundled Tor binaries, generated old flyer site, or packaging workflows on main.
  • Keep the Nostr client static and host-agnostic.
  • Do not load frontend dependencies from CDNs.
  • Treat Nostr event content as untrusted. Escape rendered content and reject unsafe schema input.
  • Preserve print behavior: app controls must not print or shift the flyer sheet in print output.
  • Preserve the old flyer visual language unless the user explicitly asks for a redesign.
  • Paper size (US Letter / A4) is a local print/view preference (localStorage), defaulted from the browser locale region. Never write it into the Nostr event — a flyer must reprint on either size without changing the source event.

Localization

  • Use site/locales.js for flyer content defaults.
  • Use NOSTR_UI in site/nostr-client.js for editor/viewer controls and Nostr-specific labels.
  • Add translations for every supported language when adding user-facing strings.
  • Check right-to-left languages when touching layout.

Verification

Run:

node --check site/nostr-client.js
pytest -q

For visual or print changes, also run a local static server and inspect the site root (/) in a browser.

Cross-browser end-to-end tests live in e2e/ (Playwright; Chromium, Firefox, WebKit, plus mobile emulations). Run them after changes that touch rendering, print, key generation, URL/redirect handling, or the loading state:

npm install && npx playwright install
npm run test:e2e

WebKit/Safari on Linux needs sudo npx playwright install-deps once. See e2e/README.md. Test tooling is a dev dependency only — it must not pull runtime frontend dependencies from CDNs or otherwise weaken the static, host-agnostic client.