From c42dbe73d9eafdafe9c5b64128efafc0349752a8 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Wed, 9 Apr 2025 10:30:21 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/d0bb09a90081783f6697cd0f2221059d9860c03f --- .../luasrc/model/cbi/passwall/client/type/hysteria2.lua | 3 ++- .../luasrc/model/cbi/passwall/client/type/sing-box.lua | 4 ++-- luci-app-passwall/luasrc/passwall/util_hysteria2.lua | 2 +- luci-app-passwall/luasrc/passwall/util_sing-box.lua | 5 +++-- .../luasrc/view/passwall/node_list/link_share_man.htm | 4 ++-- luci-app-passwall/po/zh-cn/passwall.po | 7 ++----- luci-app-passwall/root/usr/share/passwall/subscribe.lua | 3 +-- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua index 970a9e759..d8a223674 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua @@ -26,7 +26,8 @@ o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, _n("hop"), translate("Additional ports for hysteria hop")) +o = s:option(Value, _n("hop"), translate("Port hopping range")) +o.description = translate("Format as 1000:2000 or 1000-2000 Multiple groups are separated by commas (,).") o.rewrite_option = o.option o = s:option(Value, _n("obfs"), translate("Obfs Password")) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index f20b2cf0e..c5b4a72e9 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -401,8 +401,8 @@ if singbox_tags:find("with_quic") then end if singbox_tags:find("with_quic") then - o = s:option(Value, _n("hysteria2_ports"), translate("Port hopping range")) - o.description = translate("Format as 1000:2000 Multiple groups are separated by commas (,).") + o = s:option(Value, _n("hysteria2_hop"), translate("Port hopping range")) + o.description = translate("Format as 1000:2000 or 1000-2000 Multiple groups are separated by commas (,).") o:depends({ [_n("protocol")] = "hysteria2" }) o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) diff --git a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua index b818aadbf..f2668e473 100644 --- a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua +++ b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua @@ -57,7 +57,7 @@ function gen_config(var) local server = server_host .. ":" .. server_port if (node.hysteria2_hop) then - server = server .. "," .. node.hysteria2_hop + server = server .. "," .. string.gsub(node.hysteria2_hop, ":", "-") end local config = { diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index 56cee54f5..906fdc665 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -390,8 +390,9 @@ function gen_outbound(flag, node, tag, proxy_table) if node.protocol == "hysteria2" then local server_ports = {} - if node.hysteria2_ports then - for range in node.hysteria2_ports:gmatch("([^,]+)") do + if node.hysteria2_hop then + node.hysteria2_hop = string.gsub(node.hysteria2_hop, "-", ":") + for range in node.hysteria2_hop:gmatch("([^,]+)") do if range:match("^%d+:%d+$") then table.insert(server_ports, range) end diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index 8da9fa3e4..9b650af00 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -519,7 +519,7 @@ local hysteria2_type = map:get("@global_subscribe[0]", "hysteria2_type") or "sin params += opt.query("obfs", dom_prefix + "hysteria2_obfs_type"); params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password"); } - params += opt.query("mport", dom_prefix + "hysteria2_ports"); + params += opt.query("mport", dom_prefix + "hysteria2_hop"); } params = params.replace(/^&/, ""); url = @@ -1309,7 +1309,7 @@ local hysteria2_type = map:get("@global_subscribe[0]", "hysteria2_type") or "sin opt.set(dom_prefix + 'hysteria2_obfs_type', "salamander"); opt.set(dom_prefix + 'hysteria2_obfs_password', queryParam["obfs-password"]); } - opt.set(dom_prefix + 'hysteria2_ports', queryParam.mport || ""); + opt.set(dom_prefix + 'hysteria2_hop', queryParam.mport || ""); } else if (has_hysteria2) { opt.set('type', "Hysteria2"); dom_prefix = "hysteria2_" diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 3c6c3e2de..d81ab4374 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -1639,9 +1639,6 @@ msgstr "空闲超时 " msgid "Hop Interval" msgstr "端口跳跃时间 " -msgid "Additional ports for hysteria hop" -msgstr "端口跳跃额外端口" - msgid "HeartbeatPeriod(second)" msgstr "心跳周期(单位:秒)" @@ -1831,8 +1828,8 @@ msgstr "当选择的出站发生变化时中断现有连接。" msgid "Port hopping range" msgstr "端口跳跃范围" -msgid "Format as 1000:2000 Multiple groups are separated by commas (,)." -msgstr "格式为:1000:2000 多组时用逗号(,)隔开。" +msgid "Format as 1000:2000 or 1000-2000 Multiple groups are separated by commas (,)." +msgstr "格式为:1000:2000 或 1000-2000 多组时用逗号(,)隔开。" msgid "Geo View" msgstr "Geo 查询" diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 97e279491..0228816ee 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -1222,6 +1222,7 @@ local function processData(szType, content, add_mode, add_from) result.tls_allowInsecure = allowInsecure_default and "1" or "0" end result.hysteria2_tls_pinSHA256 = params.pinSHA256 + result.hysteria2_hop = params.mport if hysteria2_type_default == "sing-box" and has_singbox then result.type = 'sing-box' @@ -1230,13 +1231,11 @@ local function processData(szType, content, add_mode, add_from) result.hysteria2_obfs_type = "salamander" result.hysteria2_obfs_password = params["obfs-password"] end - result.hysteria2_ports = params.mport elseif has_hysteria2 then result.type = "Hysteria2" if params["obfs-password"] then result.hysteria2_obfs = params["obfs-password"] end - result.hysteria2_hop = params.mport end elseif szType == 'tuic' then local alias = ""