Phase 6: Mini App

A Telegram Mini App served by the core under /app/, embedded in the binary.

- API under /app/api/ with initData validated (HMAC, age) on every call
- Pages: Home, Queue, Buy (target, product, invoice), History, Groups,
  group detail (Overview, Settings, Wallet, Usage) and Me
- Every action runs through the same service, billing and scheduler code
  as the chat, so limits, prices and admin checks are decided on the server
- Texts come from the catalog over the API; layout mirrors for RTL
- Front end in web/miniapp (Vite, React, TypeScript); the build is
  committed and guarded by a source hash test; the Docker image rebuilds it
- MINIAPP_ENABLED with an https PUBLIC_URL; entry points from /app, group
  settings and the over-limit offer
- Browser test (make miniapp-e2e) against a core in test mode
- Fix: each download attempt gets its own scratch directory, so a retry
  cannot lose its file to the cleanup of the failed attempt

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Michilis
2026-11-18 10:27:20 +00:00
co-authored by Claude Fable 5.2
parent 51371da0e0
commit 4f11f939a0
55 changed files with 7069 additions and 6 deletions
+12
View File
@@ -9,8 +9,19 @@
# docker-compose.yml builds core and worker for you.
ARG GO_VERSION=1.26
ARG NODE_VERSION=24
ARG DEBIAN_VERSION=bookworm
# --- Mini App front end ------------------------------------------------------
# The repository carries a build of the Mini App already. Building it again
# here makes sure the image holds exactly what the sources say.
FROM node:${NODE_VERSION}-${DEBIAN_VERSION}-slim AS miniapp
WORKDIR /src/web/miniapp
COPY web/miniapp/package.json web/miniapp/package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY web/miniapp/ ./
RUN npm run build
# --- build -------------------------------------------------------------------
FROM golang:${GO_VERSION}-${DEBIAN_VERSION} AS build
WORKDIR /src
@@ -20,6 +31,7 @@ ENV GOTOOLCHAIN=auto CGO_ENABLED=0
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=miniapp /src/web/miniapp/dist ./web/miniapp/dist
RUN go build -trimpath -ldflags "-s -w" -o /out/core ./cmd/core \
&& go build -trimpath -ldflags "-s -w" -o /out/worker ./cmd/worker \
&& go build -trimpath -ldflags "-s -w" -o /out/faketelegram ./cmd/faketelegram