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:
co-authored by
Claude Fable 5.2
parent
51371da0e0
commit
4f11f939a0
@@ -36,6 +36,10 @@ and in groups. Written in Go on top of yt-dlp.
|
||||
- Groups: a group wallet and group pass, spending rules, admin-only
|
||||
settings with inline toggles, allowed and blocked sites, optional link
|
||||
detection, per-member usage.
|
||||
- A Mini App inside Telegram: paste a link, watch and cancel the queue,
|
||||
buy a pass or credits with a QR invoice that notices the payment, resend
|
||||
from history, manage groups (settings, wallet, spending rules, usage by
|
||||
member) and personal preferences. It is embedded in the core binary.
|
||||
- Friendly, translated error messages. Raw tool output stays in the logs.
|
||||
|
||||
## Quick start with docker compose
|
||||
@@ -169,6 +173,8 @@ The settings you are most likely to touch:
|
||||
| `PRICE_CREDIT_DOWNLOAD` | `50` | Cost of a download paid with credits |
|
||||
| `QUEUE_FREE_MAX_LEN` | `20` | Most queued free jobs |
|
||||
| `DB_DSN` | `data/dlbot.db` | SQLite file |
|
||||
| `PUBLIC_URL` | none | HTTPS address of the core, for webhooks, wallet links and the Mini App |
|
||||
| `MINIAPP_ENABLED` | `false` | Turn the Mini App on, see [docs/OPERATIONS.md](docs/OPERATIONS.md#the-mini-app) |
|
||||
| `LOG_LEVEL` | `info` | `debug`, `info`, `warn`, `error` |
|
||||
|
||||
## Development
|
||||
@@ -179,12 +185,18 @@ make test # tests only
|
||||
make e2e # real yt-dlp against a public test file, needs network
|
||||
make test-postgres PG_DSN=postgres://... # the same suite on Postgres
|
||||
make acceptance # kill a worker mid-job, watch the other finish
|
||||
make miniapp # rebuild the Mini App front end after changing web/miniapp
|
||||
make miniapp-e2e # click through the Mini App in headless Chromium
|
||||
```
|
||||
|
||||
The tests need neither a bot token nor network access. They run the real
|
||||
bot against a fake Bot API server (`internal/tg/fakeserver`) and a scripted
|
||||
yt-dlp.
|
||||
|
||||
Go is all you need to build: the Mini App's compiled front end is committed
|
||||
in `web/miniapp/dist` and embedded in the core. Node.js is only needed to
|
||||
change it. A test fails when `dist` is older than its sources.
|
||||
|
||||
## Documentation
|
||||
|
||||
- [docs/OPERATIONS.md](docs/OPERATIONS.md): deploying and running it.
|
||||
@@ -211,6 +223,8 @@ internal/ytdlp yt-dlp and ffprobe wrapper
|
||||
internal/db migrations and queries
|
||||
internal/storage file storage backends
|
||||
internal/i18n translations and formatting
|
||||
internal/api HTTP: health, payment webhook, worker protocol, Mini App API
|
||||
web/miniapp the Mini App front end (Vite, React) and its embedded build
|
||||
locales translation catalogs
|
||||
docs architecture and assumptions
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user