feat(legal): bilingual (RU + EN) legal pages with a language + theme switcher
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m14s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m48s
Add English versions of the privacy policy, EULA and offer (ui/legal/*_en.md) and render each legal page as one self-contained bilingual document: both language bodies plus a header language toggle and theme toggle (no back), a small inline ES5 script that switches language client-side (no reload, default Russian + persisted) and applies the theme (system default + persisted override) — mirroring the landing. The offer's English view transliterates the Russian product names spliced from the live catalog. renderLegalHtml now takes both language sources; renderOffer splices the price list into both; the renderer bakes and reads the _en sources and pre-renders the static pages at boot. Also wrap the /offer/ contour probe in the same retry+timeout as the legal probe (the offer page is now bilingual and larger). Docs + renderer/ui tests updated.
This commit is contained in:
+15
-9
@@ -4,7 +4,8 @@ An internal Node service that runs shared `ui/src/lib` renderers server-side —
|
||||
image build time (`src/entry.ts` → esbuild → `dist/gameimage.mjs`) so there is one renderer and no
|
||||
drift from the browser. It serves two surfaces: the finished-game export **PNG** (on
|
||||
[skia-canvas](https://github.com/samizdatco/skia-canvas), pixel-identical to the design the owner
|
||||
signed off) and the public **legal pages** (the offer, the privacy policy and the EULA).
|
||||
signed off) and the public **legal pages** (the offer, the privacy policy and the EULA), each
|
||||
bilingual (RU + EN) with a language + theme switcher.
|
||||
|
||||
## Interface
|
||||
|
||||
@@ -16,13 +17,16 @@ signed off) and the public **legal pages** (the offer, the privacy policy and th
|
||||
- `GET /offer/` — the public offer page as `text/html`: the owner-edited `ui/legal/offer_ru.md`
|
||||
(baked into the image, read at boot) with the live catalog **price list** (§4.4) fetched as
|
||||
markdown from the backend's internal `/api/v1/internal/offer/pricing` (`RENDERER_BACKEND_URL`)
|
||||
and spliced in at the `<#pricing_template#>` marker, then rendered by the shared
|
||||
`ui/src/lib/offer.ts` `renderLegalHtml`. `GET /offer` → 301 `/offer/`. Caddy routes `/offer/`
|
||||
here; a backend outage yields a 502, never a stale price list.
|
||||
and spliced in at the `<#pricing_template#>` marker of both language sources (`offer_ru.md` /
|
||||
`offer_en.md`), then rendered as one bilingual page by the shared `ui/src/lib/offer.ts`
|
||||
`renderLegalHtml` (the English view transliterates the Russian product names client-side).
|
||||
`GET /offer` → 301 `/offer/`. Caddy routes `/offer/` here; a backend outage yields a 502, never a
|
||||
stale price list.
|
||||
- `GET /privacy/` — the privacy policy, and `GET /eula/` the end-user licence agreement, both as
|
||||
`text/html`: the owner-edited `ui/legal/privacy_ru.md` / `ui/legal/eula_ru.md` (baked in, read at
|
||||
boot), rendered once at boot by the same shared `renderLegalHtml` and served from cache. **Static** — no backend fetch. `GET /privacy`
|
||||
/ `GET /eula` → 301 to the trailing-slash form. Caddy routes these here too.
|
||||
`text/html`: the owner-edited `ui/legal/{privacy,eula}_{ru,en}.md` (baked in, read at boot),
|
||||
rendered once at boot as one bilingual page by the same shared `renderLegalHtml` and served from
|
||||
cache. **Static** — no backend fetch. `GET /privacy` / `GET /eula` → 301 to the trailing-slash
|
||||
form. Caddy routes these here too.
|
||||
- `GET /healthz` — liveness (the compose healthcheck the backend's `depends_on` gates on).
|
||||
|
||||
The service renders and nothing else: for the PNG, authentication, the participant check and the
|
||||
@@ -40,8 +44,10 @@ pnpm test # bundles, then node --test (PNG smoke + offer/legal rende
|
||||
# local run on :8090 (RENDERER_PORT overrides). The server reads all three legal sources at boot, so
|
||||
# point each at its ui/legal source (the baked paths do not exist in a local checkout); /offer/ also
|
||||
# needs a reachable backend for the price fetch:
|
||||
RENDERER_OFFER_MD=../ui/legal/offer_ru.md RENDERER_PRIVACY_MD=../ui/legal/privacy_ru.md \
|
||||
RENDERER_EULA_MD=../ui/legal/eula_ru.md RENDERER_BACKEND_URL=http://localhost:8080 node src/server.mjs
|
||||
RENDERER_OFFER_MD=../ui/legal/offer_ru.md RENDERER_OFFER_EN_MD=../ui/legal/offer_en.md \
|
||||
RENDERER_PRIVACY_MD=../ui/legal/privacy_ru.md RENDERER_PRIVACY_EN_MD=../ui/legal/privacy_en.md \
|
||||
RENDERER_EULA_MD=../ui/legal/eula_ru.md RENDERER_EULA_EN_MD=../ui/legal/eula_en.md \
|
||||
RENDERER_BACKEND_URL=http://localhost:8080 node src/server.mjs
|
||||
```
|
||||
|
||||
The runtime image (`renderer/Dockerfile`, `node:22-slim`) bakes in Liberation Sans (the
|
||||
|
||||
Reference in New Issue
Block a user