diff --git a/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm b/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm index 468dfc95..8ec0ce59 100644 --- a/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm +++ b/luci-app-ssr-plus/luasrc/view/shadowsocksr/ssrurl.htm @@ -448,8 +448,10 @@ function import_ssr_url(btn, urlname, sid) { } break; case "kcp": - setElementValue('cbid.shadowsocksr.' + sid + '.kcp_guise', params.headerType || "none"); - setElementValue('cbid.shadowsocksr.' + sid + '.seed', params.seed || ""); + setElementValue('cbid.shadowsocksr.' + sid + '.kcp_guise', params.get("headerType") || "none"); + dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.kcp_guise', event); + setElementValue('cbid.shadowsocksr.' + sid + '.kcp_domain', params.get("host") || ""); + setElementValue('cbid.shadowsocksr.' + sid + '.seed', params.get("seed") || ""); break; case "http": /* this is non-standard, bullshit */ @@ -613,6 +615,8 @@ function import_ssr_url(btn, urlname, sid) { break; case "kcp": document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_guise')[0].value = params.get("headerType") || "none"; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_guise')[0].dispatchEvent(event); // 触发事件 + document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_domain')[0].value = params.get("host") || ""; document.getElementsByName('cbid.shadowsocksr.' + sid + '.seed')[0].value = params.get("seed") || ""; break; case "http": @@ -703,6 +707,9 @@ function import_ssr_url(btn, urlname, sid) { } if (ssm.net == "kcp") { document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_guise')[0].value = ssm.type; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_guise')[0].dispatchEvent(event); + document.getElementsByName('cbid.shadowsocksr.' + sid + '.kcp_domain')[0].value = ssm.host || ""; + document.getElementsByName('cbid.shadowsocksr.' + sid + '.seed')[0].value = ssm.path || ""; } if (ssm.tls == "tls") { document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls')[0].checked = true; @@ -727,7 +734,7 @@ function import_ssr_url(btn, urlname, sid) { if (ssm.vcn && ssm.vcn.trim() !== "") { document.getElementsByName('cbid.shadowsocksr.' + sid + '.tls_CertByName')[0].value = ssm.vcn; } - var allowInsecureValue = ssm.allowInsecure || ssm.allowlnsecure || ssm['skip-cert-verify']; + var allowInsecureValue = ssm.allowInsecure || ssm.allowlnsecure || ssm.insecure || ssm['skip-cert-verify']; if (allowInsecureValue === "1" || allowInsecureValue === "true") { document.getElementsByName('cbid.shadowsocksr.' + sid + '.insecure')[0].checked = true; // 设置 insecure 为 true document.getElementsByName('cbid.shadowsocksr.' + sid + '.insecure')[0].dispatchEvent(event); // 触发事件 @@ -852,6 +859,7 @@ function import_ssr_url(btn, urlname, sid) { case "kcp": setElementValue('cbid.shadowsocksr.' + sid + '.kcp_guise', params.get("headerType") || "none"); dispatchEventIfExists('cbid.shadowsocksr.' + sid + '.kcp_guise', event); + setElementValue('cbid.shadowsocksr.' + sid + '.kcp_domain', params.get("host") || ""); setElementValue('cbid.shadowsocksr.' + sid + '.seed', params.get("seed") || ""); break; case "http": diff --git a/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua b/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua index 9440abcb..d96f7058 100755 --- a/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua +++ b/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua @@ -395,7 +395,10 @@ local function processData(szType, content) end end if info.net == 'kcp' then - result.kcp_guise = info.type + result.kcp_guise = info.type or "none" + if info.type and info.type == "header-dns" then + result.kcp_guise = info.host or "" + end result.mtu = 1350 result.tti = 50 result.uplink_capacity = 5 @@ -439,19 +442,19 @@ local function processData(szType, content) result.enable_ech = "1" result.ech_config = info.ech end - -- 兼容 allowInsecure / allowlnsecure / skip-cert-verify - if info.allowInsecure or info.allowlnsecure or info["skip-cert-verify"] then - local insecure = info.allowInsecure or info.allowlnsecure or info["skip-cert-verify"] - if insecure == true or insecure == "1" or insecure == "true" then - result.insecure = "1" - end - end if info.pcs and info.pcs ~= "" then result.tls_CertSha = info.pcs end if info.vcn and info.vcn ~= "" then result.tls_CertByName = info.vcn end + -- 兼容 allowInsecure / allowlnsecure / skip-cert-verify + if info.allowInsecure or info.allowlnsecure or info.insecure or info["skip-cert-verify"] then + local insecure = info.allowInsecure or info.allowlnsecure or info.insecure or info["skip-cert-verify"] + if insecure == true or insecure == "1" or insecure == "true" then + result.insecure = "1" + end + end else result.tls = "0" end @@ -716,6 +719,9 @@ local function processData(szType, content) result.h2_path = params.path and UrlDecode(params.path) or nil elseif result.transport == "kcp" then result.kcp_guise = params.headerType or "none" + if params.headerType and params.headerType == "header-dns" then + result.kcp_domain = params.host or "" + end result.seed = params.seed result.mtu = 1350 result.tti = 50 @@ -859,7 +865,7 @@ local function processData(szType, content) result.fingerprint = params.fp end -- 处理 ech 参数 - if params.ech then + if params.ech and params.ech ~= "" then result.enable_ech = "1" result.ech_config = params.ech end @@ -908,6 +914,9 @@ local function processData(szType, content) result.h2_path = params.path and UrlDecode(params.path) or nil elseif result.transport == "kcp" then result.kcp_guise = params.headerType or "none" + if params.headerType and params.headerType == "header-dns" then + result.kcp_domain = params.host or "" + end result.seed = params.seed result.mtu = 1350 result.tti = 50 @@ -1045,6 +1054,9 @@ local function processData(szType, content) elseif result.transport == "kcp" then result.kcp_guise = params.headerType or "none" + if params.headerType and params.headerType == "header-dns" then + result.kcp_domain = params.host or "" + end result.seed = params.seed result.mtu = 1350 result.tti = 50