Maintainer repair for the #167 re-review of 25d9375f.
Blocking: "Load older messages" prepended the older page to a newest-first
list that MessagePreview reverses, so it showed under the newest message.
It is appended now.
Live media:
- LiveMedia probes each candidate key with a one-byte read and returns
ErrLiveMediaTooLarge for an object over 16 MiB before reading it. The
admin API maps it to 413 and the panel answers 413 with a plain-text
reason and the same nosniff / CSP sandbox headers.
- Responses are Cache-Control: no-store again, at both layers.
- parseMedia reads the top-level kind and the id of the right object, so
documents get their download link. Number literals are quoted before
JSON.parse, so 64-bit ids never become JS numbers.
- Tests: LiveMedia over the real files service on LocalFS (sniffing,
allowlist, key checks, the cap and the probe), /v1/media and panel proxy
headers, a messages.read gate test for /api/live/*, and a DSN-gated
dialog paging test with tied and zero dates.
Messenger:
- The dialog cursor is keyed on before_peer_id, since top_message_date is
0 for dialogs created by a scheduled message, a TTL or a chat theme.
- The dialog list has its own stale-response guard for owner switches and
"Load more chats".
- Bubbles show the box id that "Delete selected" takes.
- Detail pages preview the 50 messages ending at the opened one and keep
it in view.
- ?focus=env jumps once, so Status can be opened afterwards.
- The shell title and the lit tab use the longest matching tab path, so
group pages say Groups and detail routes light their tab; /premium is
an alias of the Premium tab.
- The remaining hardcoded strings go through i18n (en, zh, ru).
Docs: /api/live/* rows document the cursor, has_more, media types, status
codes, headers and messages.read; "Adding a page" says the shell renders
the tab bar, and the generator now fails on a <SectionTabs> in a page.
AGENTS.md, .env.example and comments use the current section names.
web/dist is rebuilt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Giveaway was a tab of its own holding one field and one button, which is
not a job a tab bar should carry. The button now sits at the bottom of the
Stars & Premium page, next to the per-user grants it belongs with, inside
a frame with a warned border: it is the only write on the page that
touches every account at once, and it keeps the same reason -> dry run ->
confirm flow as every other write.
Commerce drops to three tabs -- Stars & Premium, Prices, Stars balances --
and the last one is renamed, because "Stars" and "Stars & Premium" in the
same tab bar read as the same thing. The old /star-issue URL is an alias
of the Stars & Premium tab, so a bookmark opens the same place and the
sidebar row stays lit.
The doc generator now prints the alias paths instead of "the bare alias",
which was written for /messages and said nothing about /star-issue.
The "Give Gifts" tab lived under Commerce next to prices and stars, which
made granting a gift look like a monetization action. It belongs with the
gift catalog and the auctions, so the tab moves to the Gifts section and
its label is spelled out ("Выдача подарков") instead of repeating the
section name.
The tab keeps its route and its gifts.read right, so no permission or
bookmark changes; the page's tab bar now renders the Gifts section.
The route and permission tables in docs/admin-panel-api.{en,ru}.md had
drifted a long way out of date and nothing noticed: permissions.tsx
exported a dozen section rights the tables never mentioned, the SPA table
listed routes that no longer existed, and several pages and their rights
were missing entirely. They are generated from nav.ts, permissions.tsx and
security.go now, so editing the source and rerunning is the only way they
move -- and CI runs --check so they cannot rot unnoticed again.
The generator also documents what the panel does now, since the rules it
follows were only ever in the diff: the sidebar, the tab bars and the
route table are three views of one declaration in nav.ts, a sibling page
is a tab rather than a second sidebar row, a right outside
assignablePermissions() cannot be granted to a named operator, and the
//go:embed web/dist bundle has to be rebuilt and committed or a src change
does not ship. AGENTS.md and both API docs carry that, plus a section on
adding a page in the order that avoids repeating this drift.
docs/giftfetch.md is new, and local-setup.md points at it. Official
Star-gifts are only reachable with an authorized user session, which is the
part that actually stops people: the fetch is written up around the QR
login, the snapshot layout, the validation it performs, and the fact that
a .session file is a live account credential and belongs outside the
repository.
One fix to the generator itself. It read nav.ts's tab arrays with a
non-greedy (?P<tabs>.*?)\]\s*\}, which stops at the first ] followed by a
} -- the closing bracket of a tab's own aliases: [...] -- so the messages
section parsed to zero tabs and dropped out of the table with no error
where all the others were fine. The tabs array is now read by bracket
matching, and a section that parses to zero tabs raises instead of
vanishing, because a silently missing section is exactly the failure this
commit exists to stop.
Bring the grammy-branch grammystore work onto main: a full PostgreSQL
rewrite of the Telegram store bot, real-number mode with gramsrv
account binding, plus the admin API lookup the bot depends on. Also
wires the new endpoint into telesrv, CI, deployment and docs.
grammystore bot (cmd/bots/grammystore):
- migrate from SQLite (BOT_DB_PATH) to PostgreSQL: db/init.sql schema,
DATABASE_HOST-based config assembly, persistent upserts and tests
- new bot modes: "random" (generate free numbers) and "real" (users
bind their real Telegram phone); phone-share keyboard flow with
cancel, transient toasts and auto-deleted service messages
- real-mode number lifecycle: +888 purchases replace the account phone
on gramsrv (set-phone sync) and unbind the personal number; replaced
numbers return to the pool; a second anonymous number request is
refused; number picking guards free generation
- OTP login-code delivery routed to the chat bound to the verified
phone, per-recipient language; stopped for replaced numbers
- admin panel: exact lookups, admin can bind any number to any
Telegram account, Telegram-native ticket replies (button and
reply-to-notification), constant visible button menu after admin
actions, broadcast/stars/premium/promo/giveaway/referral/bonus
flows, payment and refund tracking against gramsrv
- gramsrv client (gramsrv.js) grows resolveUserByPhone; fetch-my-ID
flow resolves a bound phone to the server user id with graceful
error handling
- SOCKS5 proxy support for Telegram API (socks5h://), proxy tests
- Docker/GHCR image, docker-compose files and dev compose, .env
documentation, per-branch translation pairs kept in sync
gramsrv admin API and telesrv:
- POST /v1/accounts/resolve-by-phone (authenticated, read-only, no
CommandMeta): canonicalize the phone and resolve it to a user id via
the new admin.UserLookup dependency; wired in cmd/telesrv with the
user store; admin service method, server handler and tests
CI and deployment:
- bot test job runs under GitHub Actions with an ephemeral
PostgreSQL 16 service and DB-config env vars; grammystore
container build workflow
- scripts/install.sh: build telesrv server and admin panel, create
systemd units (gramsrv, gramsrv-admin), configure PostgreSQL/Redis
via docker compose
- admin panel API reference (docs/admin-panel-api.{ru,en}.md) documents
the new resolve-by-phone endpoint
Verified on the merged tree: go build ./... clean; grammystore bot test
suite 68/68 against local PostgreSQL.
Ignore inactive collectible supply for ordinary imports; preserve existing issuance caps and remaining stock under the purchase lock. Reject cap or sales-mode changes on an existing gift identity.
Add focused PostgreSQL inventory/ledger CI, revision and purchase regression tests, and Debit Stars session/CSRF coverage. Rebuild Admin assets and document the inventory contract.
Rename admin-panel.ru.md to admin-panel-api.ru.md to match content, document all API request bodies, query params and response shapes, and add an English translation.