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 9f0868a80..c78de6433 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 @@ -27,6 +27,7 @@ local header_type_list = { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard" } +local xray_version = api.get_app_version("xray") -- [[ Xray ]] s.fields["type"]:value(type_name, "Xray") @@ -106,9 +107,11 @@ o:value("leastPing") o.default = "leastPing" -- Fallback Node -if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.10") then +if api.compare_versions(xray_version, ">=", "1.8.10") then local o = s:option(ListValue, option_name("fallback_node"), translate("Fallback Node")) - o:depends({ [option_name("balancingStrategy")] = "leastPing" }) + if api.compare_versions(xray_version, "<", "1.8.12") then + o:depends({ [option_name("balancingStrategy")] = "leastPing" }) + end o:value("",translate("Null")) o.default = "" local function check_fallback_chain(fb) @@ -130,6 +133,7 @@ end -- 探测地址 local o = s:option(Flag, option_name("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL.")) o:depends({ [option_name("balancingStrategy")] = "leastPing" }) +o:depends({ [option_name("fallback_node")] = "", ["!reverse"] = true }) local o = s:option(Value, option_name("probeUrl"), translate("Probe URL")) o:depends({ [option_name("useCustomProbeUrl")] = true }) @@ -139,6 +143,7 @@ o.description = translate("The URL used to detect the connection status.") -- 探测间隔 local o = s:option(Value, option_name("probeInterval"), translate("Probe Interval")) o:depends({ [option_name("balancingStrategy")] = "leastPing" }) +o:depends({ [option_name("fallback_node")] = "", ["!reverse"] = true }) o.default = "1m" o.description = translate("The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are ns, us, ms, s, m, h, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.") @@ -401,7 +406,7 @@ o = s:option(Value, option_name("wireguard_mtu"), translate("MTU")) o.default = "1420" o:depends({ [option_name("protocol")] = "wireguard" }) -if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.0") then +if api.compare_versions(xray_version, ">=", "1.8.0") then o = s:option(Value, option_name("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings.")) o:depends({ [option_name("protocol")] = "wireguard" }) end diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 860f90926..6ab30ae53 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -693,7 +693,8 @@ function gen_config(var) -- fallback node local fallback_node_id = _node.fallback_node - if fallback_node_id and fallback_node_id ~= "" then + if fallback_node_id == "" then fallback_node_id = nil + if fallback_node_id then local is_new_node = true for _, outbound in ipairs(outbounds) do if outbound.tag == fallback_node_id then @@ -723,7 +724,7 @@ function gen_config(var) fallbackTag = fallback_node_id, strategy = { type = _node.balancingStrategy or "random" } }) - if _node.balancingStrategy == "leastPing" then + if _node.balancingStrategy == "leastPing" or fallback_node_id then if not observatory then observatory = { subjectSelector = { "blc-" },