luci-app-passwall: sync upstream

last commit: 0dcb4bbc33
This commit is contained in:
actions 2024-05-23 00:00:05 +08:00
parent a634266c9d
commit d60872531d
2 changed files with 11 additions and 5 deletions

View File

@ -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"))
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 <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, 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

View File

@ -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-" },