From af54cca2812cb099e859fc9f81e8cc6101192a30 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sat, 9 Aug 2025 16:07:08 +0200 Subject: [PATCH] fix saving sockopt --- web/assets/js/model/inbound.js | 2 +- web/html/xui/inbounds.html | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 1739b385..1e993c13 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -1691,7 +1691,7 @@ class Inbound extends XrayCommonClass { toJson() { let streamSettings; - if (this.canEnableStream()) { + if (this.canEnableStream() || this.stream?.sockopt) { streamSettings = this.stream.toJson(); } return { diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 1297b22e..b1e90de9 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -925,7 +925,11 @@ protocol: inbound.protocol, settings: inbound.settings.toString(), }; - if (inbound.canEnableStream()) data.streamSettings = inbound.stream.toString(); + if (inbound.canEnableStream()){ + data.streamSettings = inbound.stream.toString(); + } else if (inbound.stream?.sockopt) { + data.streamSettings = JSON.stringify({ sockopt: inbound.stream.sockopt.toJson() }, null, 2); + } data.sniffing = inbound.sniffing.toString(); await this.submit('/xui/inbound/add', data, inModal); @@ -944,7 +948,11 @@ protocol: inbound.protocol, settings: inbound.settings.toString(), }; - if (inbound.canEnableStream()) data.streamSettings = inbound.stream.toString(); + if (inbound.canEnableStream()){ + data.streamSettings = inbound.stream.toString(); + } else if (inbound.stream?.sockopt) { + data.streamSettings = JSON.stringify({ sockopt: inbound.stream.sockopt.toJson() }, null, 2); + } data.sniffing = inbound.sniffing.toString(); await this.submit(`/xui/inbound/update/${dbInbound.id}`, data, inModal);