The Compose UI migration (ServerUiState + BaseServerActivity) dropped or
misbound several transport-specific fields that the legacy editor handled
correctly:
1. XHTTP mode (auto/packet-up/stream-up/stream-one) — stored in
ProfileItem.xhttpMode, but ServerUiState had no field and the dropdown
was bound to state.headerType (default "none")
2. gRPC mode (gun/multi) — stored in ProfileItem.mode, same problem
3. gRPC serviceName/authority — the "gRPC Authority" field was bound to
state.host and "gRPC serviceName" to state.path, but the core outbound
builder reads ProfileItem.authority/serviceName. Editing + saving a
gRPC node wrote to host/path, breaking the connection
4. KCP seed — no field in ServerUiState, no input in the Compose UI
Changes (2 files):
ServerUiState.kt:
- Added constructor params + mutableState for: mode, xhttpMode,
serviceName, authority, seed
- fromProfileItem(): read all five from initialConfig
- toProfileItem(): write all five with .nullIfBlank()
BaseServerActivity.kt CommonNetworkFields:
- Mode dropdown dispatches by network: GRPC -> state.mode,
XHTTP -> state.xhttpMode, else -> state.headerType (TCP/KCP unchanged)
- Host/Authority field: GRPC -> state.authority, else -> state.host
- Path/serviceName field: GRPC -> state.serviceName, else -> state.path
- KCP: added seed text field, hide the path field (KCP doesn't use path;
previously it showed a second "kcp seed" label bound to the wrong field)
Null handling is safe: XhttpSettingsBean.mode is nullable and Gson omits
null fields, so xray-core falls back to its default mode; gRPC
multiMode = (mode == "multi") is null-safe (false -> default gun).
Fixes#5993
Signed-off-by: dkgks
Signed-off-by: dkgks
Co-authored-by: root <root@debianG>