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
+171
View File
@@ -599,9 +599,180 @@ other = "{{.Name}}: {{.Count}} downloads, {{.Size}}, {{.Sats}}"
unknown = "I do not know that group, or I am no longer in it."
intro = "<b>{{.Group}}</b>\nGroup balance: {{.Balance}}\n\nWhat you buy here belongs to the group: a pass covers every member, credits are spent by the group's rules."
# --- Mini App ----------------------------------------------------------------
# Everything under [app] is shown inside the Mini App, as plain text (no
# HTML). The app also reads the product, unit, btn, settings, quality and
# language tables, so names shared with the chat are written once.
[app]
unavailable = "The app is not set up on this bot."
open = "Open the app to manage downloads, passes and groups."
title = "Downloads"
retry = "Try again"
save = "Save"
saved = "Saved."
add = "Add"
close = "Close"
done = "Done"
copied = "Copied."
on = "On"
off = "Off"
untitled = "Untitled"
see_plans = "See passes and credits"
sent_to_chat = "Started. The file arrives in our chat."
pass_until = "Pass until {{.Until}}"
balance_is = "Balance: {{.Balance}}"
[app.error]
unauthorized = "Open this page from Telegram, with the Open app button of the bot."
banned = "This account cannot use the bot."
bad_link = "That does not look like a link I can use."
bad_settings = "Some of these settings are not valid."
network = "No connection. Check your network and try again."
generic = "Something went wrong. Try again."
not_found = "That is not there anymore."
[app.tab]
home = "Home"
queue = "Queue"
buy = "Buy"
groups = "Groups"
me = "Me"
[app.home]
hello = "Hi {{.Name}}"
pass_active = "Pass active"
plan_free = "Free plan"
plan_free_hint = "A pass lifts the limits and skips the line."
balance = "Balance"
today = "Today"
downloads = "Downloads"
volume = "Volume"
used_of = "{{.Used}} of {{.Max}}"
used_unlimited = "{{.Used}}, no limit"
paste_title = "New download"
paste_placeholder = "Paste a link"
look_up = "Look up"
recent = "Recent downloads"
all_history = "All"
[app.queue]
title = "Your downloads"
note = "Files arrive in your chat with the bot."
empty = "Nothing in the queue."
waiting = "Position {{.Position}}, about {{.Wait}}"
downloading = "Downloading"
downloading_pct = "Downloading, {{.Percent}}"
processing = "Processing"
sending = "Sending to Telegram"
prioritize = "Prioritize · {{.Price}}"
prioritized = "Moved to the front."
cancel_confirm = "Cancel \"{{.Title}}\"?"
cancelled = "Cancelled."
[app.buy]
unavailable = "Payments are not set up on this bot."
step = "Step {{.Step}} of {{.Total}}"
target_title = "Who is it for?"
target_note = "A group pass and group credits work for the members of that group."
for_me = "Me"
for_group = "Group"
pass_title = "Pass for {{.Target}}"
pass_note = "A pass gives the higher limits and the priority lane until it ends. Buying again adds time."
credits_title = "Credits"
credits_note = "Without a pass, a download beyond the free limits costs {{.Price}}."
paid_title = "With a pass or credits"
[app.buy.credits_downloads]
one = "about {{.Count}} download"
other = "about {{.Count}} downloads"
[app.limit]
size = "Size per download"
duration = "Length per download"
per_day = "Downloads per day"
at_once = "At the same time"
none = "No limit"
[app.invoice]
qr_alt = "Lightning invoice as a QR code"
copy = "Copy invoice"
waiting = "Waiting for payment · {{.Time}}"
checking = "Checking for the payment…"
cancel = "Cancel this invoice"
paid = "Paid"
paid_text = "{{.Product}} for {{.Amount}}. Thank you."
expired = "Invoice expired"
cancelled = "Invoice cancelled"
closed_text = "Nothing was charged. A payment that still arrives is added to the balance."
[app.history]
title = "History"
note = "Sending again counts as a new download. It is usually instant."
empty = "No downloads yet."
resend = "Send again"
[app.groups]
title = "Your groups"
note = "Groups where you are an admin and the bot is a member."
empty = "No groups yet. Add the bot to a group where you are an admin and send a command there once."
no_pass = "No pass"
[app.group]
balance = "Group balance"
pass = "Group pass"
pass_on = "Active"
pass_off = "None"
language = "Language"
auto_detect_hint = "Fetch links that members paste, without a command."
caps_title = "Caps for this group"
caps_note = "Leave empty for the normal limit ({{.Size}} per file). A cap can only lower it."
max_size = "Largest file, in MB"
max_minutes = "Longest video, in minutes"
allowed_title = "Allowed sites"
allowed_note = "When this list has entries, only these sites work in the group."
blocked_title = "Blocked sites"
blocked_note = "Links to these sites are refused in the group."
site_placeholder = "example.com"
remove_site = "Remove {{.Site}}"
top_up = "Top up or buy a pass"
rules_title = "Spending rules"
rules_note = "Group credits pay for members who are over their own limits. An empty cap means no cap."
spend_cap = "Sats per person per day"
daily_cap = "Sats per day for the whole group"
usage_empty = "No downloads in this period."
col_member = "Member"
col_downloads = "Downloads"
col_volume = "Volume"
col_spent = "Spent"
[app.group.tab]
overview = "Overview"
settings = "Settings"
wallet = "Wallet"
usage = "Usage"
[app.group.usage_title]
one = "Usage, last day"
other = "Usage, last {{.Count}} days"
[app.me]
downloads_title = "Downloads"
quality_note = "With a default set, a link starts right away instead of asking for a format."
audio_only = "Audio only"
audio_only_hint = "Always fetch the sound as MP3."
language_title = "Language"
language = "Language"
referral_title = "Invite friends"
referral_note = "When somebody you invited makes a first purchase, you get {{.Reward}}."
copy_link = "Copy link"
share = "Share"
invited = "Invited so far"
support = "Support"
[app.me.invited_count]
one = "{{.Count}} person"
other = "{{.Count}} people"
# --- Static pages ------------------------------------------------------------