From b74465e869ac14b97d7b6a40de44537e9d053457 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sat, 23 May 2026 17:27:12 +0200 Subject: [PATCH] perf(settings): use /inbounds/options for LDAP tag picker The General settings tab only needs each inbound's tag/protocol/port to fill a dropdown but was calling /panel/api/inbounds/list which ships the full settings JSON with every embedded client. Switched it to /options and added Tag to the projection. On a panel with thousands of clients this drops the General-tab load payload from megabytes to a tiny per-inbound row each. --- frontend/src/pages/settings/GeneralTab.tsx | 4 +++- web/service/inbound.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/settings/GeneralTab.tsx b/frontend/src/pages/settings/GeneralTab.tsx index e620c724..a8c20cd6 100644 --- a/frontend/src/pages/settings/GeneralTab.tsx +++ b/frontend/src/pages/settings/GeneralTab.tsx @@ -38,7 +38,9 @@ export default function GeneralTab({ allSetting, updateSetting }: GeneralTabProp useEffect(() => { let cancelled = false; (async () => { - const msg = await HttpUtil.get('/panel/api/inbounds/list') as ApiMsg<{ + // /options is the slim picker-shaped endpoint — it skips the heavy + // per-client settings and clientStats payloads that /list ships. + const msg = await HttpUtil.get('/panel/api/inbounds/options') as ApiMsg<{ tag: string; protocol: string; port: number; }[]>; if (cancelled) return; diff --git a/web/service/inbound.go b/web/service/inbound.go index bc5b253d..9064fa70 100644 --- a/web/service/inbound.go +++ b/web/service/inbound.go @@ -242,6 +242,7 @@ func (s *InboundService) annotateFallbackParents(db *gorm.DB, inbounds []*model. type InboundOption struct { Id int `json:"id"` Remark string `json:"remark"` + Tag string `json:"tag"` Protocol string `json:"protocol"` Port int `json:"port"` TlsFlowCapable bool `json:"tlsFlowCapable"` @@ -256,12 +257,13 @@ func (s *InboundService) GetInboundOptions(userId int) ([]InboundOption, error) var rows []struct { Id int `gorm:"column:id"` Remark string `gorm:"column:remark"` + Tag string `gorm:"column:tag"` Protocol string `gorm:"column:protocol"` Port int `gorm:"column:port"` StreamSettings string `gorm:"column:stream_settings"` } err := db.Table("inbounds"). - Select("id, remark, protocol, port, stream_settings"). + Select("id, remark, tag, protocol, port, stream_settings"). Where("user_id = ?", userId). Order("id ASC"). Scan(&rows).Error @@ -273,6 +275,7 @@ func (s *InboundService) GetInboundOptions(userId int) ([]InboundOption, error) out = append(out, InboundOption{ Id: r.Id, Remark: r.Remark, + Tag: r.Tag, Protocol: r.Protocol, Port: r.Port, TlsFlowCapable: inboundCanEnableTlsFlow(r.Protocol, r.StreamSettings),