mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5945] [MERGED] feat(api): add GET endpoint to look up clients by Telegram ID #6035
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#6035
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/5945
Author: @kimfom01
Created: 7/13/2026
Status: ✅ Merged
Merged: 7/28/2026
Merged by: @MHSanaei
Base:
main← Head:add-get-by-tgid-endpoint📝 Commits (10+)
bf1e664feat(api): add GET endpoint to look up clients by Telegram ID5131c4bfix: guard tgId=0 sentinel, index tg_id, deduplicate enrichment in getByTgId46059berefactor(api): move Telegram client lookup under /get/tgId/:tgIdff8cd7cMerge branch 'main' into add-get-by-tgid-endpoint0586c9dMerge branch 'main' into add-get-by-tgid-endpointc0460afMerge branch 'main' into add-get-by-tgid-endpointdb2816aMerge branch 'main' into add-get-by-tgid-endpoint9c2059bMerge branch 'main' into add-get-by-tgid-endpoint1c07282Merge branch 'main' into add-get-by-tgid-endpointdfde23aMerge branch 'main' into add-get-by-tgid-endpoint📊 Changes
7 files changed (+200 additions, -12 deletions)
View changed files
📝
frontend/public/openapi.json(+41 -0)📝
frontend/src/pages/api-docs/endpoints.ts(+10 -0)📝
internal/database/db.go(+14 -0)📝
internal/database/model/model.go(+1 -1)📝
internal/web/controller/client.go(+44 -11)📝
internal/web/service/client_lookup.go(+10 -0)➕
internal/web/service/client_lookup_test.go(+80 -0)📄 Description
Summary
Add a REST endpoint to look up clients by Telegram user ID, enabling Telegram-bot-driven integrations to resolve clients without having to scan all inbounds client-side.
Why
There was no way to query clients by tgId over HTTP, the only consumer was the internal Telegram bot via InboundService.GetClientTrafficTgBot. Migrators from other panels (e.g. Remnawave) whose bot workflows rely on tgId lookups were blocked. Closes #5879
Type of change
Areas affected
How was this tested?
Breaking changes
None. Purely additive; no existing route or config changed.
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.