feat(export): server-rendered artifacts behind one signed download URL #160
Reference in New Issue
Block a user
Delete Branch "feature/export-server-render"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Identical export on every platform (the owner's uniformity requirement): the client mints a signed relative URL (
game.export_url— new op; date locale, IANA time zone and localized labels ride it), resolves it against its own origin and hands it to the platform-native download: TelegramdownloadFile,VKWebAppDownloadFile, else a plain anchor (incl. the desktop VK iframe). Both artifacts use the route — the.gcg(clipboard mode survives only as the legacy pre-8.0-Telegram fallback) and the PNG.Renderer sidecar (
renderer/): node:22-slim + skia-canvas executing the SAMEui/src/lib/gameimage.tsthe ui unit-tests, bundled at image build (esbuild); Liberation + Noto Color Emoji baked in; internal-only, healthchecked; container smoke render verified byte-identical to the approved samples. The browser no longer renders or delivers bytes.Security: HMAC-SHA256 signed paths (
BACKEND_EXPORT_SIGN_KEY, 10-min TTL), constant-time verify, uniform 404s, param length caps, per-IP public rate limit at the gateway,/dl/*added to the caddy@gatewaymatcher (the landing catch-all trap). Mint requires an authenticated caller + finished game. Nothing stored — artifacts re-derive from the immutable journal.Deploy: renderer in compose + prod overlay +
roll rendererbefore backend + prod push list;TEST_/PROD_EXPORT_SIGN_KEYsecrets already set via API. CI: sidecar smoke in the ui job;renderer/rides the ui changes-lane.Tests: Go (sign/tamper/expiry/payload, transcode round-trip), renderer node smoke, ui vitest (codec round-trip incl. tz) + 8 e2e (download flows web/TG/legacy-TG, route-intercepted). Full suite green locally; compose (base+prod) validates.
After merge: on-device check on the contour — TG iOS/Android native download dialog, VK Android
VKWebAppDownloadFile, VK desktop anchor, web download.New commits pushed, approval review dismissed automatically according to repository settings