From fde784ab1b5aafb8eb57c59d24cdde71cccdacdf Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:28:52 +0800 Subject: [PATCH] luci: adjust Xray uTLS fingerprint option --- .../model/cbi/passwall/client/type/ray.lua | 39 +++++-------------- .../luasrc/passwall/util_xray.lua | 2 +- 2 files changed, 11 insertions(+), 30 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index 0d82ed311..1491ac5ee 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -401,21 +401,6 @@ o.default = "0" add_xray_depends(o, { [option_name("tls")] = true, [option_name("reality")] = false }) add_v2ray_depends(o, { [option_name("tls")] = true }) -o = s:option(Value, option_name("fingerprint"), translate("Finger Print"), translate("Avoid using randomized, unless you have to.")) -o:value("", translate("Disable")) -o:value("chrome") -o:value("firefox") -o:value("safari") -o:value("ios") --- o:value("android") -o:value("edge") --- o:value("360") -o:value("qq") -o:value("random") -o:value("randomized") -o.default = "" -add_xray_depends(o, { [option_name("tls")] = true, [option_name("reality")] = false }) - -- [[ REALITY部分 ]] -- o = s:option(Value, option_name("reality_publicKey"), translate("Public Key")) add_xray_depends(o, { [option_name("tls")] = true, [option_name("reality")] = true }) @@ -427,28 +412,24 @@ o = s:option(Value, option_name("reality_spiderX"), translate("Spider X")) o.placeholder = "/" add_xray_depends(o, { [option_name("tls")] = true, [option_name("reality")] = true }) -o = s:option(Value, option_name("reality_fingerprint"), translate("Finger Print"), translate("Avoid using randomized, unless you have to.")) -o.not_rewrite = true +o = s:option(Flag, option_name("utls"), translate("uTLS")) +o.default = "0" +add_xray_depends(o, { [option_name("tls")] = true, [option_name("reality")] = false }) + +o = s:option(ListValue, option_name("fingerprint"), translate("Finger Print")) o:value("chrome") o:value("firefox") -o:value("safari") -o:value("ios") --- o:value("android") o:value("edge") --- o:value("360") +o:value("safari") +o:value("360") o:value("qq") +o:value("ios") +o:value("android") o:value("random") o:value("randomized") o.default = "chrome" +add_xray_depends(o, { [option_name("tls")] = true, [option_name("utls")] = true }) add_xray_depends(o, { [option_name("tls")] = true, [option_name("reality")] = true }) -function o.cfgvalue(self, section) - return m:get(section, "fingerprint") -end -function o.write(self, section, value) - if s.fields["type"]:formvalue(arg[1]) == "Xray" or s.fields["type"]:formvalue(arg[1]) == "V2ray" then - m:set(section, "fingerprint", value) - end -end o = s:option(ListValue, option_name("transport"), translate("Transport")) o:value("tcp", "TCP") diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index fbfa4033a..4c3e927d4 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -137,7 +137,7 @@ function gen_outbound(flag, node, tag, proxy_table) tlsSettings = (node.stream_security == "tls") and { serverName = node.tls_serverName, allowInsecure = (node.tls_allowInsecure == "1") and true or false, - fingerprint = (node.type == "Xray" and node.fingerprint and node.fingerprint ~= "") and node.fingerprint or nil + fingerprint = (node.type == "Xray" and node.utls == "1" and node.fingerprint and node.fingerprint ~= "") and node.fingerprint or nil } or nil, realitySettings = (node.stream_security == "reality") and { serverName = node.tls_serverName,