mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #7012] feat(tgbot): improve admin workflows, presets, renewal and sharing #6578
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6578
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/7012
Author: @HamedSanaei
Created: 10/29/2026
Status: 🔄 Open
Base:
main← Head:feat/tgbot-admin-workflows-7010📝 Commits (10+)
b5ff50bfix(tgbot): restore the admin's client link and QR buttonsc49a71dchore(tgbot): integrate admin link navigation from #698620882dffix(runtime): preserve protocol accounts during client renewalbda0209feat(clients): persist confirmed admin plans and renewalse2fc227feat(tgbot): add localized admin plans, renewal and exports2df5a2cfix(tgbot): show unique online clients without inferred inbounds2898ceddocs(tgbot): explain confirmed admin workflows and sharingb586656fix(nodes): let acknowledged lifecycle updates settle8e98631Merge remote-tracking branch 'origin/main' into pr/69865768d0ddocs(tgbot): drop the mocked-up client card screenshots📊 Changes
68 files changed (+6045 additions, -227 deletions)
View changed files
📝
.github/workflows/ci.yml(+3 -3)📝
docs/content/docs/en/operations/telegram-bot.mdx(+136 -2)➕
docs/public/images/tgbot-admin-workflows-7010.png(+0 -0)📝
internal/database/model/model.go(+9 -0)📝
internal/mtproto/manager.go(+65 -17)➕
internal/mtproto/quota_reset_test.go(+138 -0)📝
internal/web/runtime/local.go(+27 -13)➕
internal/web/runtime/local_client_account_test.go(+122 -0)➕
internal/web/service/client_admin_mtproto_test.go(+110 -0)➕
internal/web/service/client_admin_pending.go(+69 -0)➕
internal/web/service/client_admin_postgres_test.go(+193 -0)➕
internal/web/service/client_admin_recovery_test.go(+189 -0)➕
internal/web/service/client_admin_restart_test.go(+125 -0)➕
internal/web/service/client_admin_workflow.go(+859 -0)➕
internal/web/service/client_admin_workflow_test.go(+676 -0)📝
internal/web/service/client_crud.go(+24 -21)📝
internal/web/service/client_locks.go(+28 -1)📝
internal/web/service/client_lookup.go(+16 -0)➕
internal/web/service/client_plans.go(+237 -0)➕
internal/web/service/client_plans_test.go(+187 -0)...and 48 more files
📄 Description
Summary
Adds private-admin plan management, confirmed quick creation and renewal, and a unified client Share / Export menu to the existing Telegram screens. Audits Persian bot localization and shows unique local/remote online clients without inferring active inbounds from configuration attachments.
Why
Closes #7010.
Related: #6984, #6986, #4778. This branch integrates the latest #6986 head (
2d09348c) and its original commit (b5ff50b7), preserving authorship and one set of Links / QR handlers and tests. #6986 remains open. Actual per-connection inbound attribution (#4778) and deferred renewal (#6298) remain outside this change.Type of change
Areas affected
Behavior
/add ali A,/renew ali A,/renew ali 30gb 30d, and keyboard alternatives require an owner-bound confirmation preview. Cancellation, stale client/plan versions, retries, concurrent confirmations and process restarts are covered.Renewal and persistence
settingstable. No tables, columns, migrations, HTTP routes or API artifacts are added. Full database backups retain these rows; resetting panel settings removes them. Pending previews expire after 20 minutes; old completed/uncommitted receipts are pruned after 31 days in bounded batches. Unresolved committed receipts are retained, with per-client pending indexes and reset ownership stored in the same existing settings table.ClientService.Createand inherits its per-inbound application behavior. Partial failures retain a stable operation/subscription identity for safe retry. An interrupted creation with no safely captured baseline requires reviewing the existing client rather than overwriting later edits.Security and performance
Every new command, callback and stateful input rechecks the sender and authorized private chat. Durable confirmations bind the owner, target identity and baseline; inline queries remain read-only. Export URLs are validated, HTML is escaped, filenames are sanitized and message/caption limits have explicit fallbacks. TXT exports have no arbitrary link-count limit.
Preset changes use revisions; confirmations serialize per client and coordinate with existing inbound mutation locks. Settings reads select public setting keys rather than loading operation receipts. Inbound labels use minimal selects, 400-ID batches and 20-row paging. Existing creation, traffic accounting and runtime dispatch are reused, including a shared runtime account mapping that preserves Shadowsocks ciphers, VLESS reverse tags and WireGuard keepalives.
Follow-up review fixes
Addresses the three MEDIUM and one LOW findings from reviewed head
16cd2c22:ClientService.Create's restart result on success and partial failure. Failed local renewal application requests Xray recovery; remote failures retain node synchronization without requesting a local restart.The latest #6986 follow-ups are integrated without duplicate navigation or tests. A separate trial merge with #7014 at
a92c5f9brequired resolving its moved structural block ininbound_node.go; retaining the frozen-lifecycle and pending-reset guards there passed workflow, snapshot, runtime and node-contract regressions. #7014's features are not included here, and this review revision does not modifyinbound_node.go.How was this tested?
Validation on published head
e189268cae375617d460bfd172928a318f2a2434:make verify: passed, including the full shuffled Go suite, bot authorization/localization, generation, lint, formatting, typechecking, Go/frontend/Storybook builds and OpenAPI comparison. Frontend: 222 files / 2,045 tests passed.make race: passed locally and in CI; no data races.make node-e2e: passed, including both enrollment scopes and the three-panel global-traffic/reset/recreation chain.FuzzParseLinkandFuzzDecodeCertPin: passed, 30 seconds each.git diff --check: passed. No generated API changes.The first, heavily concurrent local verify run hit four unchanged Outbound form test timeouts. All 22 tests in that file then passed in isolation with the original timeouts, followed by the successful complete verify run above. No tests, assertions or timeout settings were weakened.
GitHub CI on
e189268cae375617d460bfd172928a318f2a2434: all 12 check runs passed, including race, node E2E, PostgreSQL, frontend and the separate docs build.Screenshots / recordings
The image below renders recorded Bot API screen content from regression tests with fictional clients. It is not a screenshot from a live Telegram account; paginated preview text is combined for readability.
Breaking changes
None. Existing HTTP request/response contracts, portable client exports, self-service access and automatic-renewal scheduling are unchanged. No deployment or production-server changes were performed.
External runtime delivery retains the existing retry/acknowledgement model; it is not a distributed transaction with Xray or sidecars. The old-MTProto fallback restarts the affected whole MTProto instance and can disconnect its clients; it does not restart unrelated MTProto inbounds or turn remote failures into a global Xray restart. Contract tests exercise real gRPC and HTTP endpoints, but no live Telegram account or production traffic was used. Active-inbound attribution remains limited as described above.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.