Skip to content

Commit

Permalink
luci-app-mosdns: fix using local filter lists to get stuck in infinit…
Browse files Browse the repository at this point in the history
…e loops

Signed-off-by: sbwml <admin@cooluc.com>
  • Loading branch information
sbwml committed Feb 26, 2024
1 parent 67e8851 commit 0da873f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion luci-app-mosdns/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-mosdns
PKG_VERSION:=1.5.17
PKG_VERSION:=1.5.18
PKG_RELEASE:=1

LUCI_TITLE:=LuCI Support for mosdns
Expand Down
3 changes: 1 addition & 2 deletions luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ o.default = "geosite.dat"
o:value("geosite.dat", "v2ray-geosite")
o:value("https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/master/anti-ad-domains.txt", "anti-AD")
o:value("https://raw.githubusercontent.com/Cats-Team/AdRules/main/mosdns_adrules.txt", "Cats-Team/AdRules")
o:value("https://raw.githubusercontent.com/ookangzheng/dbl-oisd-nl/master/dbl_light.txt", "oisd (small)")
o:value("https://raw.githubusercontent.com/ookangzheng/dbl-oisd-nl/master/dbl.txt", "oisd (big)")
o:value("https://raw.githubusercontent.com/neodevpro/neodevhost/master/domain", "NEO DEV HOST")

o = s:taboption("basic", Button, "_reload", translate("Restart-Service"), translate("Restart the MosDNS process to take effect of new configuration"))
o.write = function()
Expand Down
4 changes: 3 additions & 1 deletion luci-app-mosdns/root/etc/init.d/mosdns
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ start_service() {
if [ -f "/etc/mosdns/rule/.ad_source" ]; then
for url in $ad_source;
do
[ "$url" = "geosite.dat" ] && continue
if [ "$url" = "geosite.dat" ] || [ $(echo "$url" | grep -c -E "^file://") -eq 1 ]; then
continue
fi
if [ $(grep -c "$url" "/etc/mosdns/rule/.ad_source") -eq 0 ]; then
update_list=1
break
Expand Down
9 changes: 8 additions & 1 deletion luci-app-mosdns/root/usr/share/mosdns/mosdns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,17 @@ get_adlist() (

adlist_update() {
[ "$(uci -q get mosdns.config.adblock)" != 1 ] && exit 0
lock_file=/var/lock/mosdns_ad_update.lock
ad_source=$(uci -q get mosdns.config.ad_source)
AD_TMPDIR=$(mktemp -d) || exit 1
mirror=""
: > /etc/mosdns/rule/.ad_source
if [ -f "$lock_file" ]; then
has_update=0
exit 0
else
: > $lock_file
fi
has_update=0
for url in $ad_source;
do
Expand All @@ -83,7 +90,7 @@ adlist_update() {
\cp $AD_TMPDIR/* /etc/mosdns/rule/adlist
}
fi
rm -rf "$AD_TMPDIR"
rm -rf "$AD_TMPDIR" $lock_file
}

geodat_update() (
Expand Down

0 comments on commit 0da873f

Please sign in to comment.