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

luci-app-ssr-plus: adjust and optimize.

zxlhhyccc 6 дней назад
Родитель
Сommit
8ea2450a54

+ 78 - 75
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua

@@ -13,6 +13,7 @@ local m, s, o
 local sid = arg[1]
 local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
 local xray_version = nil
+local xray_version_val = 0
 
 -- 确保正确判断程序是否存在
 local function is_finded(e)
@@ -25,16 +26,28 @@ end
 
 -- 获取 Xray 版本号
 if is_finded("xray") then
-    local version = luci.sys.exec("xray version 2>&1")
-    if version and version ~= "" then
-        xray_version = version:match("Xray%s+([%d%.]+)")
-    end
+	local version = luci.sys.exec("xray version 2>&1")
+	if version and version ~= "" then
+		xray_version = version:match("Xray%s+([%d%.]+)")
+	end
+end
+
+-- 将 Xray 版本号转换为数字
+if xray_version and xray_version ~= "" then
+	local major, minor, patch =
+		xray_version:match("(%d+)%.?(%d*)%.?(%d*)")
+
+	major = tonumber(major) or 0
+	minor = tonumber(minor) or 0
+	patch = tonumber(patch) or 0
+
+	xray_version_val = major * 10000 + minor * 100 + patch
 end
 
 -- 默认的保存并应用行为
 local function apply_redirect(m)
-    local tmp_uci_file = "/etc/config/" .. "shadowsocksr" .. "_redirect"
-    if m.redirect and m.redirect ~= "" then
+	local tmp_uci_file = "/etc/config/" .. "shadowsocksr" .. "_redirect"
+	if m.redirect and m.redirect ~= "" then
 		if nixio.fs.access(tmp_uci_file) then
 			local redirect
 			for line in io.lines(tmp_uci_file) do
@@ -54,9 +67,9 @@ local function apply_redirect(m)
 				uci:set("shadowsocksr" .. "_redirect", "@redirect[0]", "url", redirect)
 			end
 		end
-    else
+	else
 		luci.sys.call("/bin/rm -f " .. tmp_uci_file)
-    end
+	end
 end
 
 local has_xray = is_finded("xray")
@@ -199,35 +212,35 @@ o.description = translate("The configured type also applies to the core specifie
 -- 设置默认 Xray 或 Hysteria2 核心
 -- 动态添加选项
 if has_xray then
-    o:value("xray", translate("Xray"))
+	o:value("xray", translate("Xray"))
 end
 if has_hysteria2 then
-    o:value("hysteria2", translate("Hysteria2"))
+	o:value("hysteria2", translate("Hysteria2"))
 end
 -- 设置默认值
 if xray_hy2_type == "xray" then
-    o.default = "xray"
+	o.default = "xray"
 elseif xray_hy2_type == "hysteria2" then
-    o.default = "hysteria2"
+	o.default = "hysteria2"
 end
 o.write = function(self, section, value)
-    -- 更新 Hysteria 节点的 xray_hy2_type
-    uci:foreach("shadowsocksr", "servers", function(s)
-        local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
-        if node_type == "hysteria2" then  -- 仅修改 Hysteria 节点
-            local old_value = uci:get("shadowsocksr", s[".name"], "xray_hy2_type")
-            if old_value ~= value then
-                uci:set("shadowsocksr", s[".name"], "xray_hy2_type", value)
-            end
-        end
-    end)
-    -- 更新 server_subscribe 的 xray_hy2_type
-    local old_value = uci:get("shadowsocksr", "server_subscribe", "xray_hy2_type")
-    if old_value ~= value then
+	-- 更新 Hysteria 节点的 xray_hy2_type
+	uci:foreach("shadowsocksr", "servers", function(s)
+		local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
+		if node_type == "hysteria2" then  -- 仅修改 Hysteria 节点
+			local old_value = uci:get("shadowsocksr", s[".name"], "xray_hy2_type")
+			if old_value ~= value then
+				uci:set("shadowsocksr", s[".name"], "xray_hy2_type", value)
+			end
+		end
+	end)
+	-- 更新 server_subscribe 的 xray_hy2_type
+	local old_value = uci:get("shadowsocksr", "server_subscribe", "xray_hy2_type")
+	if old_value ~= value then
         uci:set("shadowsocksr", "@server_subscribe[0]", "xray_hy2_type", value)
-    end
-    -- 更新当前 section 的 xray_hy2_type
-    ListValue.write(self, section, value)
+	end
+	-- 更新当前 section 的 xray_hy2_type
+	ListValue.write(self, section, value)
 end
 
 o = s:option(ListValue, "type", translate("Server Node Type"))
@@ -281,36 +294,36 @@ o.description = translate("Selection ShadowSocks Node Use Version.")
 -- 设置默认 Shadowsocks 版本
 -- 动态添加选项
 if has_ss_rust then
-    o:value("ss-rust", translate("ShadowSocks-rust Version"))
+	o:value("ss-rust", translate("ShadowSocks-rust Version"))
 end
 if has_ss_libev then
-    o:value("ss-libev", translate("ShadowSocks-libev Version"))
+	o:value("ss-libev", translate("ShadowSocks-libev Version"))
 end
 -- 设置默认值
 if ss_type == "ss-rust" then
-    o.default = "ss-rust"
+	o.default = "ss-rust"
 elseif ss_type == "ss-libev" then
-    o.default = "ss-libev"
+	o.default = "ss-libev"
 end
 o:depends("type", "ss")
 o.write = function(self, section, value)
-    -- 更新 Shadowsocks 节点的 has_ss_type
-    uci:foreach("shadowsocksr", "servers", function(s)
-        local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
-        if node_type == "ss" then  -- 仅修改 Shadowsocks 节点
-            local old_value = uci:get("shadowsocksr", s[".name"], "has_ss_type")
-            if old_value ~= value then
-                uci:set("shadowsocksr", s[".name"], "has_ss_type", value)
-            end
-        end
-    end)
-    -- 更新 server_subscribe 的 ss_type
-    local old_value = uci:get("shadowsocksr", "server_subscribe", "ss_type")
-    if old_value ~= value then
-        uci:set("shadowsocksr", "@server_subscribe[0]", "ss_type", value)
-    end
-    -- 更新当前 section 的 has_ss_type
-    ListValue.write(self, section, value)
+	-- 更新 Shadowsocks 节点的 has_ss_type
+	uci:foreach("shadowsocksr", "servers", function(s)
+		local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
+		if node_type == "ss" then  -- 仅修改 Shadowsocks 节点
+			local old_value = uci:get("shadowsocksr", s[".name"], "has_ss_type")
+			if old_value ~= value then
+				uci:set("shadowsocksr", s[".name"], "has_ss_type", value)
+			end
+		end
+	end)
+	-- 更新 server_subscribe 的 ss_type
+	local old_value = uci:get("shadowsocksr", "server_subscribe", "ss_type")
+	if old_value ~= value then
+		uci:set("shadowsocksr", "@server_subscribe[0]", "ss_type", value)
+	end
+	-- 更新当前 section 的 has_ss_type
+	ListValue.write(self, section, value)
 end
 
 o = s:option(ListValue, "v2ray_protocol", translate("V2Ray/XRay protocol"))
@@ -1279,20 +1292,22 @@ o:depends("type", "hysteria2")
 o:depends("type", "trojan")
 o:depends("type", "tuic")
 o.description = translate("If true, allowss insecure connection at TLS client, e.g., TLS server uses unverifiable certificates.")
--- Xray 的26.1.31 以下版本使用
-if xray_version and xray_version ~= "" then
-	-- 提取所有数字部分,允许版本号有1到3个部分,不足部分补0
-	local major, minor, patch =
-		xray_version:match("(%d+)%.?(%d*)%.?(%d*)")
-	-- 将字符串转换为数字,空字符串转为0
-	major = tonumber(major) or 0
-	minor = tonumber(minor) or 0
-	patch = tonumber(patch) or 0
-	-- 如果版本低于 26.1.31
-	if (major * 10000 + minor * 100 + patch) < 260131 then
-		o:depends("tls", true)
-		o:depends({ type = "v2ray", v2ray_protocol = "vless", reality = true })
-	end
+-- Xray 版本判断
+if xray_version_val < 260131 then
+	-- Xray 版本小于 26.1.31
+	o:depends("tls", true)
+	o:depends({ type = "v2ray", v2ray_protocol = "vless", reality = true })
+else
+	-- Xray 版本大于等于 26.1.31
+	-- [[ Xray TLS pinSHA256 ]] --
+	o = s:option(Value, "tls_CertSha", translate("TLS Chain Fingerprint (SHA256)"), translate("Once set, connects only when the server’s chain fingerprint matches."))
+	o.rmempty = true
+	o:depends({type = "v2ray", tls = true})
+
+	-- [[ Xray TLS verify leaf certificate name ]] --
+	o = s:option(Value, "tls_CertByName", translate("TLS Certificate Name (CertName)"), translate("TLS is used to verify the leaf certificate name."))
+	o.rmempty = true
+	o:depends({type = "v2ray", tls = true})
 end
 
 -- [[ Hysteria2 TLS pinSHA256 ]] --
@@ -1300,18 +1315,6 @@ o = s:option(Value, "pinsha256", translate("Certificate fingerprint"))
 o:depends("type", "hysteria2")
 o.rmempty = true
 
--- [[ Xray TLS pinSHA256 ]] --
-o = s:option(Value, "chain_fingerprint", translate("TLS Chain Fingerprint (SHA256)"), translate("Once set, connects only when the server’s chain fingerprint matches."))
-o.rmempty = true
-o:depends({type = "v2ray", tls = true})
-o:depends({type = "v2ray", reality = true})
-
--- [[ Xray TLS verify leaf certificate name ]] --
-o = s:option(Value, "verify_name", translate("TLS Certificate Name (CertName)"), translate("TLS is used to verify the leaf certificate name."))
-o.rmempty = true
-o:depends({type = "v2ray", tls = true})
-o:depends({type = "v2ray", reality = true})
-
 -- [[ Mux.Cool ]] --
 o = s:option(Flag, "mux", translate("Mux"), translate("Enable Mux.Cool"))
 o.rmempty = false

+ 55 - 55
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/servers.lua

@@ -12,7 +12,7 @@ local server_count = 0
 
 -- 确保正确判断程序是否存在
 local function is_finded(e)
-    return luci.sys.exec(string.format('type -t -p "%s" 2>/dev/null', e)) ~= ""
+	return luci.sys.exec(string.format('type -t -p "%s" 2>/dev/null', e)) ~= ""
 end
 
 local has_xray = is_finded("xray")
@@ -21,19 +21,19 @@ local has_hysteria2 = is_finded("hysteria")
 local hy2_type_list = {}
 
 if has_xray then
-    table.insert(hy2_type_list, { id = "xray", name = translate("Xray") })
+	table.insert(hy2_type_list, { id = "xray", name = translate("Xray") })
 end
 if has_hysteria2 then
-    table.insert(hy2_type_list, { id = "hysteria2", name = translate("Hysteria2") })
+	table.insert(hy2_type_list, { id = "hysteria2", name = translate("Hysteria2") })
 end
 
 -- 如果用户没有手动设置,则自动选择
 if not xray_hy2_type or xray_hy2_type == "" then
-    if has_hysteria2 then
-        xray_hy2_type = "hysteria2"
-    elseif has_xray then
-        xray_hy2_type = "xray"
-    end
+	if has_hysteria2 then
+		xray_hy2_type = "hysteria2"
+	elseif has_xray then
+		xray_hy2_type = "xray"
+	end
 end
 
 local has_ss_rust = is_finded("sslocal") or is_finded("ssserver")
@@ -42,19 +42,19 @@ local has_ss_libev = is_finded("ss-redir") or is_finded("ss-local")
 local ss_type_list = {}
 
 if has_ss_rust then
-    table.insert(ss_type_list, { id = "ss-rust", name = translate("ShadowSocks-rust Version") })
+	table.insert(ss_type_list, { id = "ss-rust", name = translate("ShadowSocks-rust Version") })
 end
 if has_ss_libev then
-    table.insert(ss_type_list, { id = "ss-libev", name = translate("ShadowSocks-libev Version") })
+	table.insert(ss_type_list, { id = "ss-libev", name = translate("ShadowSocks-libev Version") })
 end
 
 -- 如果用户没有手动设置,则自动选择
 if not ss_type or ss_type == "" then
-    if has_ss_rust then
-        ss_type = "ss-rust"
-    elseif has_ss_libev then
-        ss_type = "ss-libev"
-    end
+	if has_ss_rust then
+		ss_type = "ss-rust"
+	elseif has_ss_libev then
+		ss_type = "ss-libev"
+	end
 end
 
 uci:foreach("shadowsocksr", "servers", function(s)
@@ -94,7 +94,7 @@ o:depends("auto_update", "1")
 
 o = s:option(ListValue, "auto_update_min_time", translate("Regular update (Min)"))
 for i = 0, 59 do
-    o:value(i, i .. ":00")
+	o:value(i, i .. ":00")
 end
 o.default = 30
 o.rmempty = true
@@ -102,50 +102,50 @@ o:depends("auto_update", "1")
 
 -- 确保 hy2_type_list 不为空
 if #hy2_type_list > 0 then
-    o = s:option(ListValue, "xray_hy2_type", string.format("<b><span style='color:red;'>%s</span></b>", translatef("%s Node Use Type", "Hysteria2")))
+	o = s:option(ListValue, "xray_hy2_type", string.format("<b><span style='color:red;'>%s</span></b>", translatef("%s Node Use Type", "Hysteria2")))
 	o.description = translate("The configured type also applies to the core specified when manually importing nodes.")
-    for _, v in ipairs(hy2_type_list) do
-        o:value(v.id, v.name) -- 存储 "Xray" / "Hysteria2",但 UI 显示完整名称
-    end
-    o.default = xray_hy2_type  -- 设置默认值
-    o.write = function(self, section, value)
-        -- 更新 Hysteria 节点的 xray_hy2_type
-        uci:foreach("shadowsocksr", "servers", function(s)
-            local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
-            if node_type == "hysteria2" then  -- 仅修改 Hysteria 节点
-                local old_value = uci:get("shadowsocksr", s[".name"], "xray_hy2_type")
-                if old_value ~= value then
-                    uci:set("shadowsocksr", s[".name"], "xray_hy2_type", value)
-                end
-            end
-        end)
-        -- 更新当前 section 的 xray_hy2_type
-        ListValue.write(self, section, value)
-    end
+	for _, v in ipairs(hy2_type_list) do
+		o:value(v.id, v.name) -- 存储 "Xray" / "Hysteria2",但 UI 显示完整名称
+	end
+	o.default = xray_hy2_type  -- 设置默认值
+	o.write = function(self, section, value)
+		-- 更新 Hysteria 节点的 xray_hy2_type
+		uci:foreach("shadowsocksr", "servers", function(s)
+			local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
+			if node_type == "hysteria2" then  -- 仅修改 Hysteria 节点
+				local old_value = uci:get("shadowsocksr", s[".name"], "xray_hy2_type")
+				if old_value ~= value then
+					uci:set("shadowsocksr", s[".name"], "xray_hy2_type", value)
+				end
+			end
+		end)
+		-- 更新当前 section 的 xray_hy2_type
+		ListValue.write(self, section, value)
+	end
 end
 
 -- 确保 ss_type_list 不为空
 if #ss_type_list > 0 then
-    o = s:option(ListValue, "ss_type", string.format("<b><span style='color:red;'>%s</span></b>", translatef("%s Node Use Version", "ShadowSocks")))
-    o.description = translate("Selection ShadowSocks Node Use Version.")
-    for _, v in ipairs(ss_type_list) do
-        o:value(v.id, v.name) -- 存储 "ss-libev" / "ss-rust",但 UI 显示完整名称
-    end
-    o.default = ss_type  -- 设置默认值
-    o.write = function(self, section, value)
-        -- 更新 Shadowsocks 节点的 has_ss_type
-        uci:foreach("shadowsocksr", "servers", function(s)
-            local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
-            if node_type == "ss" then  -- 仅修改 Shadowsocks 节点
-                local old_value = uci:get("shadowsocksr", s[".name"], "has_ss_type")
-                if old_value ~= value then
-                    uci:set("shadowsocksr", s[".name"], "has_ss_type", value)
-                end
-            end
-        end)
-        -- 更新当前 section 的 ss_type
-        ListValue.write(self, section, value)
-    end
+	o = s:option(ListValue, "ss_type", string.format("<b><span style='color:red;'>%s</span></b>", translatef("%s Node Use Version", "ShadowSocks")))
+	o.description = translate("Selection ShadowSocks Node Use Version.")
+	for _, v in ipairs(ss_type_list) do
+		o:value(v.id, v.name) -- 存储 "ss-libev" / "ss-rust",但 UI 显示完整名称
+	end
+	o.default = ss_type  -- 设置默认值
+	o.write = function(self, section, value)
+		-- 更新 Shadowsocks 节点的 has_ss_type
+		uci:foreach("shadowsocksr", "servers", function(s)
+			local node_type = uci:get("shadowsocksr", s[".name"], "type")  -- 获取节点类型
+			if node_type == "ss" then  -- 仅修改 Shadowsocks 节点
+				local old_value = uci:get("shadowsocksr", s[".name"], "has_ss_type")
+				if old_value ~= value then
+					uci:set("shadowsocksr", s[".name"], "has_ss_type", value)
+				end
+			end
+		end)
+		-- 更新当前 section 的 ss_type
+		ListValue.write(self, section, value)
+	end
 end
 
 o = s:option(DynamicList, "subscribe_url", translate("Subscribe URL"))

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

@@ -132,10 +132,10 @@ function import_ssr_url(btn, urlname, sid) {
 				document.getElementsByName('cbid.shadowsocksr.' + sid + '.v2ray_protocol')[0].dispatchEvent(event);
 
 				if (params.get("pcs")) {
-					document.getElementsByName('cbid.shadowsocksr.' + sid + '.chain_fingerprint')[0].value = params.get("pcs") || "";
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertSha')[0].value = params.get("pcs") || "";
 				}
 				if (params.get("vcn")) {
-					document.getElementsByName('cbid.shadowsocksr.' + sid + '.verify_name')[0].value = params.get("vcn") || "";
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertByName')[0].value = params.get("vcn") || "";
 				}
 			}
 			document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = url.hostname;
@@ -405,10 +405,10 @@ function import_ssr_url(btn, urlname, sid) {
 						}
 					}
 					if (params.pcs && params.pcs.trim() !== "") {
-						setElementValue('cbid.shadowsocksr.' + sid + '.chain_fingerprint', params.pcs);
+						setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertSha', params.pcs);
 					}
 					if (params.vcn && params.vcn.trim() !== "") {
-						setElementValue('cbid.shadowsocksr.' + sid + '.verify_name', params.vcn);
+						setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertByName', params.vcn);
 					}
 					setElementValue('cbid.shadowsocksr.' + sid + '.tls_flow', params.flow || "none");
 					dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.tls_flow', event);
@@ -570,10 +570,10 @@ function import_ssr_url(btn, urlname, sid) {
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_alpn')[0].value = params.get("alpn") || "";
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.fingerprint')[0].value = params.get("fp") || "";
 					if (params.get("pcs") && params.get("pcs").trim() !== "") {
-						document.getElementsByName('cbid.shadowsocksr.' + sid + '.chain_fingerprint')[0].value = params.get("pcs");
+						document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertSha')[0].value = params.get("pcs");
 					}
 					if (params.get("vcn") && params.get("vcn").trim() !== "") {
-						document.getElementsByName('cbid.shadowsocksr.' + sid + '.verify_name')[0].value = params.get("vcn");
+						document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertByName')[0].value = params.get("vcn");
 					}
 				}
 				switch (params.get("type")) {
@@ -711,10 +711,10 @@ function import_ssr_url(btn, urlname, sid) {
 					document.getElementsByName('cbid.shadowsocksr.' + sid + '.ech_config')[0].value = ssm.ech;
 				}
 				if (params.pcs && params.pcs.trim() !== "") {
-					document.getElementsByName('cbid.shadowsocksr.' + sid + '.chain_fingerprint')[0].value = ssm.pcs;
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertSha')[0].value = ssm.pcs;
 				}
 				if (params.vcn && params.vcn.trim() !== "") {
-					document.getElementsByName('cbid.shadowsocksr.' + sid + '.verify_name')[0].value = ssm.vcn;
+					document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertByName')[0].value = ssm.vcn;
 				}
 				document.getElementsByName('cbid.shadowsocksr.' + sid + '.insecure')[0].checked =
 					!!(ssm.allowInsecure ?? ssm.allowlnsecure ?? ssm['skip-cert-verify']); // 设置 insecure 为 true
@@ -801,10 +801,10 @@ function import_ssr_url(btn, urlname, sid) {
 					}
 				}
 				if (params.get("pcs") && params.get("pcs").trim() !== "") {
-					setElementValue('cbid.shadowsocksr.' + sid + '.chain_fingerprint', params.get("pcs"));
+					setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertSha', params.get("pcs"));
 				}
 				if (params.get("vcn") && params.get("vcn").trim() !== "") {
-					setElementValue('cbid.shadowsocksr.' + sid + '.verify_name', params.get("vcn"));
+					setElementValue('cbid.shadowsocksr.' + sid + '.tls_CertByName', params.get("vcn"));
 				}
 
 				setElementValue('cbid.shadowsocksr.' + sid + '.tls_alpn', params.get("alpn") || "");

Разница между файлами не показана из-за своего большого размера
+ 169 - 169
luci-app-ssr-plus/po/templates/ssr-plus.pot


Разница между файлами не показана из-за своего большого размера
+ 169 - 169
luci-app-ssr-plus/po/zh_Hans/ssr-plus.po


+ 25 - 14
luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua

@@ -18,6 +18,7 @@ local xray_fragment = ucursor:get_all("shadowsocksr", "@global_xray_fragment[0]"
 local xray_noise = ucursor:get_all("shadowsocksr", "@xray_noise_packets[0]") or {}
 local outbound_settings = nil
 local xray_version = nil
+local xray_version_val = 0
 
 local node_id = server_section
 local remarks = server.alias or ""
@@ -35,6 +36,18 @@ if is_finded("xray") then
 	end
 end
 
+-- 将 Xray 版本号转换为数字
+if xray_version and xray_version ~= "" then
+	local major, minor, patch =
+		xray_version:match("(%d+)%.?(%d*)%.?(%d*)")
+
+	major = tonumber(major) or 0
+	minor = tonumber(minor) or 0
+	patch = tonumber(patch) or 0
+
+	xray_version_val = major * 10000 + minor * 100 + patch
+end
+
 function vmess_vless()
 	outbound_settings = {
 		vnext = {
@@ -254,18 +267,8 @@ end
 					end)() or nil,
 					fingerprint = server.fingerprint,
 					allowInsecure = (function()
-						if xray_version and xray_version ~= "" then
-							-- 提取所有数字部分,允许版本号有1到3个部分,不足部分补0
-							local major, minor, patch =
-								xray_version:match("(%d+)%.?(%d*)%.?(%d*)")
-							-- 将字符串转换为数字,空字符串转为0
-							major = tonumber(major) or 0
-							minor = tonumber(minor) or 0
-							patch = tonumber(patch) or 0
-							-- 如果版本低于 26.1.31
-							if (major * 10000 + minor * 100 + patch) < 260131 then
-								return (server.insecure == "1" or server.insecure == true or server.insecure == "true")
-							end
+						if xray_version_val < 260131 then
+							return server.insecure == "1"
 						end
 						return nil
 					end)(),
@@ -274,8 +277,16 @@ end
 						usage = "verify",
 						certificateFile = server.certpath
 					} or nil,
-					pinnedPeerCertSha256 = server.chain_fingerprint or nil,
-					verifyPeerCertByName = server.verify_name or nil,
+					pinnedPeerCertSha256 = (function()
+						if xray_version_val < 260131 then return nil end
+						if not server.tls_CertSha then return "" end
+						return server.tls_CertSha
+					end)(),
+					verifyPeerCertByName = (function()
+						if xray_version_val < 260131 then return nil end
+						if not server.tls_CertByName then return "" end
+						return server.tls_CertByName
+					end)(),
 					echConfigList = (server.enable_ech == "1") and server.ech_config or nil,
 					echForceQuery = (server.enable_ech == "1") and (server.ech_ForceQuery or "none") or nil
 				} or nil,

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

@@ -231,10 +231,10 @@ local function processData(szType, content)
 		else
 			result.v2ray_protocol = has_xray_hy2_type
 			if params.pcs then
-				result.chain_fingerprint = params.pcs
+				result.tls_CertSha = params.pcs
 			end
 			if params.vcn then
-				result.verify_name = params.vcn
+				result.tls_CertByName = params.vcn
 			end
 		end
 
@@ -435,10 +435,10 @@ local function processData(szType, content)
 				end
 			end
 			if info.pcs and info.pcs ~= "" then
-				result.chain_fingerprint = info.pcs
+				result.tls_CertSha = info.pcs
 			end
 			if info.vcn and info.vcn ~= "" then
-				result.verify_name = info.vcn
+				result.tls_CertByName = info.vcn
 			end
 		else
 			result.tls = "0"
@@ -646,10 +646,10 @@ local function processData(szType, content)
 				result.tls_alpn = params.alpn
 			end
 			if params.pcs and params.pcs ~= "" then
-				result.chain_fingerprint = params.pcs
+				result.tls_CertSha = params.pcs
 			end
 			if params.vcn and params.vcn ~= "" then
-				result.verify_name = params.vcn
+				result.tls_CertByName = params.vcn
 			end
 			result.tls_host = params.sni
 			result.tls_flow = (params.security == "tls" or params.security == "reality") and params.flow or nil
@@ -853,10 +853,10 @@ local function processData(szType, content)
 					result.transport = "xhttp"
 				end
 				if params.pcs and params.pcs ~= "" then
-					result.chain_fingerprint = params.pcs
+					result.tls_CertSha = params.pcs
 				end
 				if params.vcn and params.vcn ~= "" then
-					result.verify_name = params.vcn
+					result.tls_CertByName = params.vcn
 				end
 				if result.transport == "ws" then
 					result.ws_host = (result.tls ~= "1") and (params.host and UrlDecode(params.host)) or nil
@@ -962,12 +962,12 @@ local function processData(szType, content)
 
 		-- 处理 pinsha256 参数
 		if params.pcs and params.pcs ~= "" then
-			result.chain_fingerprint = params.pcs
+			result.tls_CertSha = params.pcs
 		end
 
 		-- 处理 Leaf Certificate Name 参数
 		if params.vcn and params.vcn ~= "" then
-			result.verify_name = params.vcn
+			result.tls_CertByName = params.vcn
 		end
 
 		-- Reality 参数

Некоторые файлы не были показаны из-за большого количества измененных файлов