mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-02-28 05:02:59 +00:00
1.7 KiB
1.7 KiB
06. Custom Client-Center Feature
Goal
Add a true operator-friendly client-first page while preserving 3x-ui compatibility and minimizing break risk.
Implemented design
A new orchestration layer was added:
- Master client profile table
- Master client <-> inbound assignment mapping table
- Sync logic that creates/updates/removes native inbound clients automatically
Added backend pieces
Models:
MasterClientMasterClientInbound
Service:
web/service/client_center.go
Controller/API:
web/controller/client_center.go- Mounted in
web/controller/api.gounder/panel/api/clients/*
Added frontend pieces
- Route:
/panel/clients - Page:
web/html/clients.html - Sidebar item:
web/html/component/aSidebar.html
API surface
GET /panel/api/clients/listGET /panel/api/clients/inboundsPOST /panel/api/clients/addPOST /panel/api/clients/update/:idPOST /panel/api/clients/del/:id
Behavior notes
- Supports multi-client protocols (vless/vmess/trojan/shadowsocks).
- Assignment email is generated uniquely per inbound.
- Master profile fields are synced to assigned inbound client entries.
- Detach can fail if an inbound would be left with zero clients (inherited safety rule).
Stability fix included
xray/api.go now guards nil handler client and returns clear errors in:
AddInboundDelInboundAddUserRemoveUser
This prevents nil-pointer panics during local/dev conditions.
Files touched (feature)
database/model/model.godatabase/db.goweb/service/client_center.goweb/controller/client_center.goweb/controller/api.goweb/controller/xui.goweb/html/clients.htmlweb/html/component/aSidebar.htmlxray/api.go