Просмотр исходного кода

Merge pull request #1895 from zxlhhyccc/tuic

luci-app-ssr-plus: Fix Xray xhttp proto import and subscribe.
zxl hhyccc 3 дней назад
Родитель
Сommit
cc80cdf845

+ 3 - 7
luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm

@@ -438,10 +438,8 @@ function import_ssr_url(btn, urlname, sid) {
 					break;
 				case "xhttp":
 				case "splithttp":
-					if (params.security !== "tls") {
-						setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_host', params.host ? decodeURIComponent(params.host) : "");
-					}
 					setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_mode', params.mode || "auto");
+					setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_host', params.host ? decodeURIComponent(params.host) : "");
 					setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_path', params.path ? decodeURIComponent(params.path) : "/");
 					if (params.extra && params.extra.trim() !== "") {
 						setElementValue('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra', true); // 设置 enable_xhttp_extra 为 true
@@ -604,8 +602,8 @@ function import_ssr_url(btn, urlname, sid) {
 					break;
 				case "xhttp":
 				case "splithttp":
-					document.getElementsByName('cbid.shadowsocksr.' + sid + '.xhttp_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : "";
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.xhttp_mode')[0].value = params.get("mode") || "auto";
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.xhttp_host')[0].value = params.get("host") ? decodeURIComponent(params.get("host")) : "";
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.xhttp_path')[0].value = params.get("path") ? decodeURIComponent(params.get("path")) : "/";
 					if (params.get("extra") && params.get("extra").trim() !== "") {
 						document.getElementsByName('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra')[0].checked = true; // 设置 enable_xhttp_extra 为 true
@@ -842,10 +840,8 @@ function import_ssr_url(btn, urlname, sid) {
 				break;
 			case "xhttp":
 			case "splithttp":
-				if (params.get("security") !== "tls") {
-					setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_host', params.get("host") ? decodeURIComponent(params.get("host")) : "");
-				}
 				setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_mode', params.get("mode") || "auto");
+				setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_host', params.get("host") ? decodeURIComponent(params.get("host")) : "");
 				setElementValue('cbid.shadowsocksr.' + sid + '.xhttp_path', params.get("path") ? decodeURIComponent(params.get("path")) : "/");
 				if (params.get("extra") && params.get("extra").trim() !== "") {
 					setElementValue('cbid.shadowsocksr.' + sid + '.enable_xhttp_extra', true); // 设置 enable_xhttp_extra 为 true

+ 3 - 3
luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua

@@ -691,8 +691,8 @@ local function processData(szType, content)
 				result.httpupgrade_host = (result.tls ~= "1") and (params.host and UrlDecode(params.host)) or nil
 				result.httpupgrade_path = params.path and UrlDecode(params.path) or "/"
 			elseif result.transport == "xhttp" or result.transport == "splithttp" then
-				result.xhttp_host = (result.tls ~= "1") and (params.host and UrlDecode(params.host)) or nil
 				result.xhttp_mode = params.mode or "auto"
+				result.xhttp_host = params.host and UrlDecode(params.host) or nil
 				result.xhttp_path = params.path and UrlDecode(params.path) or "/"
 				-- 检查 extra 参数是否存在且非空
 				if params.extra and params.extra ~= "" then
@@ -884,8 +884,8 @@ local function processData(szType, content)
 					result.httpupgrade_host = (result.tls ~= "1") and (params.host and UrlDecode(params.host)) or nil
 					result.httpupgrade_path = params.path and UrlDecode(params.path) or "/"
 				elseif result.transport == "xhttp" or result.transport == "splithttp" then
-					result.xhttp_host = (result.tls ~= "1") and (params.host and UrlDecode(params.host)) or nil
 					result.xhttp_mode = params.mode or "auto"
+					result.xhttp_host = params.host and UrlDecode(params.host) or nil
 					result.xhttp_path = params.path and UrlDecode(params.path) or "/"
 					-- 检查 extra 参数是否存在且非空
 					if params.extra and params.extra ~= "" then
@@ -1023,8 +1023,8 @@ local function processData(szType, content)
 			result.httpupgrade_path = params.path and UrlDecode(params.path) or "/"
 
 		elseif result.transport == "xhttp" then
-			result.xhttp_host = (result.tls ~= "1" and result.reality ~= "1") and (params.host and UrlDecode(params.host)) or nil
 			result.xhttp_mode = params.mode or "auto"
+			result.xhttp_host = params.host and UrlDecode(params.host) or nil
 			result.xhttp_path = params.path and UrlDecode(params.path) or "/"
 			if params.extra and params.extra ~= "" then
 				result.enable_xhttp_extra = "1"