Remove streamSettings for protocols that don't support it

- Frontend: Only include streamSettings in toJson() for vmess, vless, trojan, shadowsocks, and hysteria protocols
- Frontend: Hide Stream tab in Advanced section for unsupported protocols
- Frontend: Clear streamSettings in Advanced tab when switching to unsupported protocols
- Frontend: Add CodeMirror JSON editor to config view in index page with mobile responsive design
- Backend: Add normalizeStreamSettings() to clear streamSettings for tunnel, mixed, http, tun, and wireguard protocols
- Backend: Apply normalization in AddInbound() and UpdateInbound()
- Backend: Add omitempty JSON tag to StreamSettings field to exclude null values from Xray config
This commit is contained in:
MHSanaei
2026-05-14 23:18:23 +02:00
parent b79abc8bc9
commit 6badd829df
7 changed files with 200 additions and 106 deletions
+2 -2
View File
@@ -13,9 +13,9 @@ type InboundConfig struct {
Port int `json:"port"`
Protocol string `json:"protocol"`
Settings json_util.RawMessage `json:"settings"`
StreamSettings json_util.RawMessage `json:"streamSettings"`
StreamSettings json_util.RawMessage `json:"streamSettings,omitempty"`
Tag string `json:"tag"`
Sniffing json_util.RawMessage `json:"sniffing"`
Sniffing json_util.RawMessage `json:"sniffing,omitempty"`
}
// Equals compares two InboundConfig instances for deep equality.