feat(export): platform-native delivery — TG popup+downloadFile, VK viewer, mobile share sheet
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 14s
CI / ui (pull_request) Failing after 1m7s
CI / conformance (pull_request) Successful in 9s
CI / gate (pull_request) Failing after 0s
CI / deploy (pull_request) Has been skipped

Per the on-device review, the last hop is now the most native affordance
per platform, all fed by the same signed URL:

- Telegram: the native showPopup chooser returns (safe here — the whole
  TG chain is bridge calls, which need no user activation) and both
  formats go to the native downloadFile dialog on iOS and Android alike.
- VK: the PNG opens in VK's native photo viewer (VKWebAppShowImages) —
  on screen at once, saved/shared from the viewer's own controls; the
  GCG keeps VKWebAppDownloadFile; either falls back to a plain anchor
  download (the desktop iframe). The gateway now serves /dl/* via
  http.ServeContent (Content-Length + Range/206) — another swing at the
  VK Android DownloadManager hang; if it persists, the next step is the
  clipboard fallback for the VK-Android GCG.
- Mobile browsers: the OS share sheet with the fetched file (the proven
  fetch-then-share pattern) — nothing lands in Downloads first; desktop
  keeps the anchor download.

Legacy Telegram (< 8.0, no downloadFile) keeps the app modal + GCG
clipboard copy and hides the image option.
This commit is contained in:
Ilia Denisov
2026-07-02 22:19:46 +02:00
parent c3c27bba5e
commit c3c26bbbc0
11 changed files with 189 additions and 60 deletions
+8 -3
View File
@@ -794,9 +794,14 @@ platform: the client calls the authenticated `game.export_url` op, the backend m
**relative, HMAC-signed, short-lived path**
(`/dl/{game}/{kind}?e=<expiry>&…&s=<HMAC-SHA256>`, 10-minute TTL,
`BACKEND_EXPORT_SIGN_KEY`), and the client resolves it against its **own origin** (no
service ever needs to know the public host) and hands it to the platform's native
download: Telegram `downloadFile` (Bot API 8.0), `VKWebAppDownloadFile`, or a plain
browser anchor elsewhere (including the desktop VK iframe). The GET is the gateway's
service ever needs to know the public host) and hands it to the platform's most
native affordance: Telegram `downloadFile` (Bot API 8.0; the chooser there is the
native showPopup — the whole TG chain is activation-free bridge calls), VK's native
photo viewer for the PNG (`VKWebAppShowImages`) + `VKWebAppDownloadFile` for the
GCG, the OS share sheet with the fetched file on a mobile browser, or a plain
anchor download (desktop, and the VK desktop iframe fallback). The gateway serves
the bytes via `http.ServeContent` (Content-Length + Range/206 — Android's system
DownloadManager hangs on chunked bodies of unknown length). The GET is the gateway's
**only unauthenticated data route** (`/dl/*` — in the caddy `@gateway` matcher and the
per-IP public rate limiter): the native download calls carry no cookies or headers, so
the URL's signature — verified by the backend on its `/api/v1/public` group in constant