From d5efb00b6d85913c5977836c19263330208f3f5c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 2 May 2026 20:20:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=84=20Sync=202026-05-02=2020:20:38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luci-app-mosdns/Makefile | 2 +- luci-app-mosdns/root/etc/init.d/mosdns | 2 +- luci-app-passwall/Makefile | 2 +- luci-app-passwall/luasrc/passwall/api.lua | 22 +++++++ .../luasrc/passwall/util_sing-box.lua | 32 +++++----- .../luasrc/passwall/util_xray.lua | 35 +++++----- .../root/usr/share/passwall/app.sh | 22 +------ luci-app-webdav/Makefile | 2 +- .../share/luci/menu.d/luci-app-webdav.json | 10 +-- mosdns/Makefile | 2 +- ...-support-hosts-file-format-blocking-.patch | 64 +++++++++++++++++++ openwrt-natmapt/Makefile | 4 +- 12 files changed, 129 insertions(+), 70 deletions(-) create mode 100644 mosdns/patches/208-feat-adblock_set-support-hosts-file-format-blocking-.patch diff --git a/luci-app-mosdns/Makefile b/luci-app-mosdns/Makefile index 6365a2dc5..46090929f 100644 --- a/luci-app-mosdns/Makefile +++ b/luci-app-mosdns/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-mosdns PKG_VERSION:=1.7.2 -PKG_RELEASE:=6 +PKG_RELEASE:=7 LUCI_TITLE:=LuCI Support for mosdns LUCI_PKGARCH:=all diff --git a/luci-app-mosdns/root/etc/init.d/mosdns b/luci-app-mosdns/root/etc/init.d/mosdns index 07675bfd8..fe7104400 100755 --- a/luci-app-mosdns/root/etc/init.d/mosdns +++ b/luci-app-mosdns/root/etc/init.d/mosdns @@ -66,7 +66,7 @@ generate_config() { json_close_object # api json_add_object 'api' - json_add_string "http" "0.0.0.0:$listen_port_api" + json_add_string "http" "127.0.0.1:$listen_port_api" json_close_object # include json_add_array "include" diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index b19f5340c..8a156e6a6 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=26.4.15 -PKG_RELEASE:=106 +PKG_RELEASE:=107 PKG_PO_VERSION:=$(PKG_VERSION) PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 1e91681d3..c4fe8a464 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -945,6 +945,28 @@ function parseURL(url_str) return res end +function parseDoH(doh_str) + doh_str = trim(doh_str) + if doh_str == "" then return nil end + + local url_part, ip_part + if doh_str:find(",", 1, true) then + url_part, ip_part = doh_str:match("^([^,]+),(.+)$") + else + url_part = doh_str + end + + local res = parseURL(url_part) + if not res then return nil end + + res.url = url_part + if ip_part and ip_part ~= "" and is_ip(ip_part) then + res.hostip = ip_part + end + + return res +end + local default_file_tree = { x86_64 = "amd64", x86 = "386", diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index f3abedbd2..a71df99c5 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -166,7 +166,7 @@ function gen_outbound(flag, node, tag, proxy_table) local server_port local server_path if dns_proto == "https" then - local _a = api.parseURL(node.domain_resolver_dns_https) + local _a = api.parseDoH(node.domain_resolver_dns_https) if _a then server_address = _a.hostname server_port = _a.port or 443 @@ -1024,10 +1024,7 @@ function gen_config(var) local remote_dns_udp_port = var["remote_dns_udp_port"] local remote_dns_tcp_server = var["remote_dns_tcp_server"] local remote_dns_tcp_port = var["remote_dns_tcp_port"] - local remote_dns_doh_url = var["remote_dns_doh_url"] - local remote_dns_doh_host = var["remote_dns_doh_host"] - local remote_dns_doh_ip = var["remote_dns_doh_ip"] - local remote_dns_doh_port = var["remote_dns_doh_port"] + local remote_dns_doh = var["remote_dns_doh"] local remote_dns_http3 = var["remote_dns_http3"] local remote_dns_client_ip = var["remote_dns_client_ip"] local remote_dns_query_strategy = var["remote_dns_query_strategy"] @@ -1762,13 +1759,15 @@ function gen_config(var) remote_server.type = "udp" remote_server.server = remote_dns_udp_server remote_server.server_port = server_port + elseif remote_dns_tcp_server then local server_port = tonumber(remote_dns_tcp_port) or 53 remote_server.type = "tcp" remote_server.server = remote_dns_tcp_server remote_server.server_port = server_port - elseif remote_dns_doh_url then - local _a = api.parseURL(remote_dns_doh_url) + + elseif remote_dns_doh then + local _a = api.parseDoH(remote_dns_doh) if _a then remote_server.type = "https" if remote_dns_http3 then @@ -1777,15 +1776,16 @@ function gen_config(var) remote_server.server = _a.hostname remote_server.server_port = _a.port or 443 remote_server.path = _a.pathname or "" - end - if api.datatypes.hostname(remote_dns_doh_host) then - if remote_dns_doh_ip and remote_dns_doh_host ~= remote_dns_doh_ip and api.is_ip(remote_dns_doh_ip) then - if not hosts_predefined then hosts_predefined = {} end - hosts_predefined[remote_dns_doh_host] = remote_dns_doh_ip - remote_server_domain_resolver = "hosts" - else - GLOBAL.DNS_HOSTNAME[remote_dns_doh_host] = true - remote_server_domain_resolver = "direct" + + if api.datatypes.hostname(_a.hostname) then + if _a.hostip then + if not hosts_predefined then hosts_predefined = {} end + hosts_predefined[_a.hostname] = _a.hostip + remote_server_domain_resolver = "hosts" + else + GLOBAL.DNS_HOSTNAME[_a.hostname] = true + remote_server_domain_resolver = "direct" + end end end end diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 753a4ce77..c45b79f40 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -408,9 +408,9 @@ function gen_outbound(flag, node, tag, proxy_table) local config_address local config_port if dns_proto == "https" then - local _a = api.parseURL(node.domain_resolver_dns_https) + local _a = api.parseDoH(node.domain_resolver_dns_https) if _a then - config_address = node.domain_resolver_dns_https + config_address = _a.url config_port = _a.port or 443 if _a.hostname and api.datatypes.hostname(_a.hostname) then GLOBAL.DNS_HOSTNAME[_a.hostname] = true @@ -801,10 +801,7 @@ function gen_config(var) local remote_dns_udp_port = var["remote_dns_udp_port"] local remote_dns_tcp_server = var["remote_dns_tcp_server"] local remote_dns_tcp_port = var["remote_dns_tcp_port"] - local remote_dns_doh_url = var["remote_dns_doh_url"] - local remote_dns_doh_host = var["remote_dns_doh_host"] - local remote_dns_doh_ip = var["remote_dns_doh_ip"] - local remote_dns_doh_port = var["remote_dns_doh_port"] + local remote_dns_doh = var["remote_dns_doh"] local remote_dns_client_ip = var["remote_dns_client_ip"] local remote_dns_fake = var["remote_dns_fake"] local remote_dns_query_strategy = var["remote_dns_query_strategy"] @@ -1497,7 +1494,7 @@ function gen_config(var) }) end - if (remote_dns_udp_server and remote_dns_udp_port) or (remote_dns_tcp_server and remote_dns_tcp_port) or remote_dns_doh_url or #node_dns > 0 then + if (remote_dns_udp_server and remote_dns_udp_port) or (remote_dns_tcp_server and remote_dns_tcp_port) or remote_dns_doh or #node_dns > 0 then if not routing then routing = { domainStrategy = "IPOnDemand", @@ -1560,22 +1557,24 @@ function gen_config(var) if remote_dns_udp_server then _remote_dns.address = remote_dns_udp_server _remote_dns.port = tonumber(remote_dns_udp_port) or 53 + elseif remote_dns_tcp_server then _remote_dns.address = "tcp://" .. remote_dns_tcp_server .. ":" .. tonumber(remote_dns_tcp_port) or 53 - end - local _remote_dns_host - if remote_dns_doh_url and remote_dns_doh_host then - if api.datatypes.hostname(remote_dns_doh_host) then - if remote_dns_doh_ip and remote_dns_doh_host ~= remote_dns_doh_ip and api.is_ip(remote_dns_doh_ip) then - dns.hosts[remote_dns_doh_host] = remote_dns_doh_ip - _remote_dns_host = remote_dns_doh_host - else - GLOBAL.DNS_HOSTNAME[remote_dns_doh_host] = true + elseif remote_dns_doh then + local _a = api.parseDoH(remote_dns_doh) + if _a then + _remote_dns.address = _a.url + _remote_dns.port = _a.port or 443 + + if api.datatypes.hostname(_a.hostname) then + if _a.hostip then + dns.hosts[_a.hostname] = _a.hostip + else + GLOBAL.DNS_HOSTNAME[_a.hostname] = true + end end end - _remote_dns.address = remote_dns_doh_url - _remote_dns.port = tonumber(remote_dns_doh_port) end if next(_remote_dns) then diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index 34f3c200c..e0ec208b4 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -172,12 +172,7 @@ run_singbox() { json_add_string "remote_dns_${_proto}_port" "${_dns_port}" ;; doh|http3) - local _doh_url _doh_host _doh_port _doh_bootstrap - parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap - [ -n "$_doh_bootstrap" ] && json_add_string "remote_dns_doh_ip" "${_doh_bootstrap}" - json_add_string "remote_dns_doh_port" "${_doh_port}" - json_add_string "remote_dns_doh_url" "${_doh_url}" - json_add_string "remote_dns_doh_host" "${_doh_host}" + json_add_string "remote_dns_doh" "${remote_dns_doh}" [ "$remote_dns_protocol" = "http3" ] && json_add_string "remote_dns_http3" "1" ;; esac @@ -269,12 +264,7 @@ run_xray() { json_add_string "remote_dns_${_proto}_port" "${_dns_port}" ;; doh) - local _doh_url _doh_host _doh_port _doh_bootstrap - parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap - [ -n "$_doh_bootstrap" ] && json_add_string "remote_dns_doh_ip" "${_doh_bootstrap}" - json_add_string "remote_dns_doh_port" "${_doh_port}" - json_add_string "remote_dns_doh_url" "${_doh_url}" - json_add_string "remote_dns_doh_host" "${_doh_host}" + json_add_string "remote_dns_doh" "${remote_dns_doh}" ;; esac @@ -1351,10 +1341,6 @@ start_dns() { local remote_dns_doh=$(config_t_get global remote_dns_doh "https://1.1.1.1/dns-query") _args="${_args} remote_dns_doh=${remote_dns_doh}" echolog " - Sing-Box DNS(${TUN_DNS}) -> ${remote_dns_doh}" - - local _doh_url _doh_host _doh_port _doh_bootstrap - parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap - [ -n "${_doh_bootstrap}" ] && REMOTE_DNS="${_doh_bootstrap}#${_doh_port}" ;; esac _args="${_args} dns_socks_address=127.0.0.1 dns_socks_port=${tcp_node_socks_port}" @@ -1390,10 +1376,6 @@ start_dns() { local remote_dns_doh=$(config_t_get global remote_dns_doh "https://1.1.1.1/dns-query") _args="${_args} remote_dns_doh=${remote_dns_doh}" echolog " - Xray DNS(${TUN_DNS}) -> ${remote_dns_doh}" - - local _doh_url _doh_host _doh_port _doh_bootstrap - parse_doh "$remote_dns_doh" _doh_url _doh_host _doh_port _doh_bootstrap - [ -n "${_doh_bootstrap}" ] && REMOTE_DNS="${REMOTE_DNS},${_doh_bootstrap}#${_doh_port}" ;; esac _args="${_args} dns_socks_address=127.0.0.1 dns_socks_port=${tcp_node_socks_port}" diff --git a/luci-app-webdav/Makefile b/luci-app-webdav/Makefile index 654c2fc77..7c5120204 100644 --- a/luci-app-webdav/Makefile +++ b/luci-app-webdav/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-webdav PKG_VERSION:=1.0.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 LUCI_TITLE:=LuCI support for WebDav LUCI_PKGARCH:=all diff --git a/luci-app-webdav/root/usr/share/luci/menu.d/luci-app-webdav.json b/luci-app-webdav/root/usr/share/luci/menu.d/luci-app-webdav.json index 73c6b6018..1c82b285e 100644 --- a/luci-app-webdav/root/usr/share/luci/menu.d/luci-app-webdav.json +++ b/luci-app-webdav/root/usr/share/luci/menu.d/luci-app-webdav.json @@ -1,14 +1,6 @@ { - "admin/nas": { - "title": "NAS", - "order": 44, - "action": { - "type": "firstchild" - } - }, - "admin/nas/webdav": { + "admin/services/webdav": { "title": "WebDAV", - "order": 90, "action": { "type": "view", "path": "webdav" diff --git a/mosdns/Makefile b/mosdns/Makefile index 28739afe1..ae7788199 100644 --- a/mosdns/Makefile +++ b/mosdns/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mosdns PKG_VERSION:=5.3.4 -PKG_RELEASE:=8 +PKG_RELEASE:=9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/IrineSistiana/mosdns/tar.gz/v$(PKG_VERSION)? diff --git a/mosdns/patches/208-feat-adblock_set-support-hosts-file-format-blocking-.patch b/mosdns/patches/208-feat-adblock_set-support-hosts-file-format-blocking-.patch new file mode 100644 index 000000000..cc3215b13 --- /dev/null +++ b/mosdns/patches/208-feat-adblock_set-support-hosts-file-format-blocking-.patch @@ -0,0 +1,64 @@ +From 8f9c6ca1ac8e9b5e10a5c45f3f338546424c95f1 Mon Sep 17 00:00:00 2001 +From: sbwml +Date: Sat, 2 May 2026 13:43:31 +0800 +Subject: [PATCH] feat(adblock_set): support hosts file format blocking rules + +Parse lines like "0.0.0.0 domain" and "127.0.0.1 domain" as exact-match +blocking rules, compatible with AdGuard Home hosts-style lists. + +Signed-off-by: sbwml +--- + plugin/data_provider/adblock_set/adblock_set_test.go | 6 ++++++ + plugin/data_provider/adblock_set/parser.go | 12 ++++++++++++ + 2 files changed, 18 insertions(+) + +--- a/plugin/data_provider/adblock_set/adblock_set_test.go ++++ b/plugin/data_provider/adblock_set/adblock_set_test.go +@@ -42,6 +42,8 @@ func TestParseAndMatch(t *testing.T) { + blocked.com + domain:ntp.org + full:metrics.icloud.com ++0.0.0.0 singlehotmilf.online ++127.0.0.1 deezer.deliveryengine.adswizz.com + ` + blacklist := domain.NewMixMatcher[struct{}]() + whitelist := domain.NewMixMatcher[struct{}]() +@@ -75,6 +77,10 @@ full:metrics.icloud.com + {"sub.ntp.org", true}, // matched by domain:ntp.org + {"metrics.icloud.com", true}, // matched by full:metrics.icloud.com + {"sub.metrics.icloud.com", false}, // full match only ++ {"singlehotmilf.online", true}, // hosts: 0.0.0.0 ++ {"sub.singlehotmilf.online", false}, // hosts: exact match only ++ {"deezer.deliveryengine.adswizz.com", true}, // hosts: 127.0.0.1 ++ {"sub.deezer.deliveryengine.adswizz.com", false}, // hosts: exact match only + } + + for _, tt := range tests { +--- a/plugin/data_provider/adblock_set/parser.go ++++ b/plugin/data_provider/adblock_set/parser.go +@@ -22,6 +22,7 @@ package adblock_set + import ( + "bufio" + "io" ++ "net" + "strings" + + "github.com/IrineSistiana/mosdns/v5/pkg/matcher/domain" +@@ -36,6 +37,17 @@ func ParseRules(r io.Reader, blacklist, + continue + } + ++ // Handle hosts file format: "0.0.0.0 domain" or "127.0.0.1 domain" ++ if fields := strings.Fields(line); len(fields) >= 2 { ++ if ip := net.ParseIP(fields[0]); ip != nil { ++ host := fields[1] ++ if host != "" && host != "localhost" { ++ _ = blacklist.Add("full:"+host, struct{}{}) ++ } ++ continue ++ } ++ } ++ + // Handle whitelists + isWhitelist := false + if strings.HasPrefix(line, "@@") { diff --git a/openwrt-natmapt/Makefile b/openwrt-natmapt/Makefile index 00d11e0d9..4948a4610 100644 --- a/openwrt-natmapt/Makefile +++ b/openwrt-natmapt/Makefile @@ -9,7 +9,7 @@ PKG_NAME:=natmapt PKG_UPSTREAM_VERSION:=20260214 PKG_UPSTREAM_GITHASH:= PKG_VERSION:=$(PKG_UPSTREAM_VERSION)$(if $(PKG_UPSTREAM_GITHASH),~$(call version_abbrev,$(PKG_UPSTREAM_GITHASH))) -PKG_RELEASE:=2 +PKG_RELEASE:=3 SCRIPTS_VERSION:=0.2026.01.24 PKG_SOURCE_SUBDIR:=$(PKG_UPSTREAM_NAME)-$(PKG_UPSTREAM_VERSION) @@ -23,7 +23,7 @@ PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.xz else PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/heiher/natmap.git -PKG_SOURCE_VERSION:=b098467e0b9e8e6cd81f6baf398f11f247bb5afb +PKG_SOURCE_VERSION:=079bce1d6c5798fa6f47d364b737762dae89aafc PKG_MIRROR_HASH:=skip PKG_SOURCE:=$(PKG_SOURCE_SUBDIR)-$(PKG_SOURCE_VERSION).tar.gz