mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 20:54:14 +00:00
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.
This commit is contained in:
parent
b3db26c4d8
commit
b74465e869
2 changed files with 7 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in a new issue