From 9b91153d047ebca3960974467d13dd9fac40cad1 Mon Sep 17 00:00:00 2001 From: sbwml Date: Sat, 31 Aug 2024 15:00:11 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall2/commit/4323de1e8c843766a857b151cf828871f65ff166 --- .../model/cbi/passwall2/client/acl_config.lua | 15 +++++++++++---- .../root/usr/share/passwall2/app.sh | 2 +- .../root/usr/share/passwall2/rule_update.lua | 6 +++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua index 12ec9960b..e6c9730c8 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua @@ -202,6 +202,17 @@ o:value("default", translate("Use global config") .. "(" .. UDP_REDIR_PORTS .. " o:value("1:65535", translate("All")) o.validate = port_validate +o = s:option(ListValue, "direct_dns_query_strategy", translate("Direct Query Strategy")) +o.default = "UseIP" +o:value("UseIP") +o:value("UseIPv4") +o:value("UseIPv6") +o:depends({ node = "default", ['!reverse'] = true }) + +o = s:option(Flag, "write_ipset_direct", translate("Direct DNS result write to IPSet"), translate("Perform the matching direct domain name rules into IP to IPSet/NFTSet, and then connect directly (not entering the core). Maybe conflict with some special circumstances.")) +o.default = "1" +o:depends({ node = "default", ['!reverse'] = true }) + o = s:option(ListValue, "remote_dns_protocol", translate("Remote DNS Protocol")) o:value("tcp", "TCP") o:value("doh", "DoH") @@ -291,8 +302,4 @@ for k, v in pairs(nodes_table) do end end -o = s:option(Flag, "write_ipset_direct", translate("Direct DNS result write to IPSet"), translate("Perform the matching direct domain name rules into IP to IPSet/NFTSet, and then connect directly (not entering the core). Maybe conflict with some special circumstances.")) -o.default = "1" -o:depends({ node = "default", ['!reverse'] = true }) - return m diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index 485d1518e..fa2e73bf3 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -337,7 +337,7 @@ run_xray() { [ -n "${direct_ipset}" ] && _extra_param="${_extra_param} -direct_ipset ${direct_ipset}" [ -n "${direct_nftset}" ] && _extra_param="${_extra_param} -direct_nftset ${direct_nftset}" } - _extra_param="${_extra_param} -direct_dns_udp_port ${DIRECT_DNS_UDP_PORT} -direct_dns_udp_server ${DIRECT_DNS_UDP_SERVER} -direct_dns_query_strategy UseIP" + _extra_param="${_extra_param} -direct_dns_udp_port ${DIRECT_DNS_UDP_PORT} -direct_dns_udp_server ${DIRECT_DNS_UDP_SERVER} -direct_dns_query_strategy ${direct_dns_query_strategy}" DNS_REMOTE_ARGS="" case "$remote_dns_protocol" in diff --git a/luci-app-passwall2/root/usr/share/passwall2/rule_update.lua b/luci-app-passwall2/root/usr/share/passwall2/rule_update.lua index 60e55fdc1..b51c2181e 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/rule_update.lua +++ b/luci-app-passwall2/root/usr/share/passwall2/rule_update.lua @@ -108,14 +108,14 @@ local function fetch_geosite() local json = jsonc.parse(content) if json.tag_name and json.assets then for _, v in ipairs(json.assets) do - if v.name and v.name == "geosite.dat.sha256sum" then + if v.name and (v.name == "geosite.dat.sha256sum" or v.name == "dlc.dat.sha256sum") then local sret = curl(v.browser_download_url, "/tmp/geosite.dat.sha256sum") if sret == 200 then local f = io.open("/tmp/geosite.dat.sha256sum", "r") local content = f:read() f:close() f = io.open("/tmp/geosite.dat.sha256sum", "w") - f:write(content:gsub("geosite.dat", "/tmp/geosite.dat"), "") + f:write(content:gsub("[^%s]+.dat", "/tmp/geosite.dat"), "") f:close() if nixio.fs.access(asset_location .. "geosite.dat") then @@ -126,7 +126,7 @@ local function fetch_geosite() end end for _2, v2 in ipairs(json.assets) do - if v2.name and v2.name == "geosite.dat" then + if v2.name and (v2.name == "geosite.dat" or v2.name == "dlc.dat") then sret = curl(v2.browser_download_url, "/tmp/geosite.dat") if luci.sys.call('sha256sum -c /tmp/geosite.dat.sha256sum > /dev/null 2>&1') == 0 then luci.sys.call(string.format("mkdir -p %s && cp -f %s %s", asset_location, "/tmp/geosite.dat", asset_location .. "geosite.dat"))