diff --git a/package/lean/luci-app-adbyby-plus/Makefile b/package/lean/luci-app-adbyby-plus/Makefile
index 95d1f0acb..08970b263 100644
--- a/package/lean/luci-app-adbyby-plus/Makefile
+++ b/package/lean/luci-app-adbyby-plus/Makefile
@@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +dnsmasq-full
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-adbyby-plus
PKG_VERSION:=2.0
-PKG_RELEASE:=58
+PKG_RELEASE:=61
include $(TOPDIR)/feeds/luci/luci.mk
diff --git a/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua b/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua
index 24d3edc5c..85b82b496 100644
--- a/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua
+++ b/package/lean/luci-app-adbyby-plus/luasrc/controller/adbyby.lua
@@ -32,14 +32,29 @@ function refresh_data()
local set =luci.http.formvalue("set")
local icount =0
-if set == "gfw_data" then
- retstring ="0"
-elseif set == "ip_data" then
+if set == "rule_data" then
+luci.sys.exec("/usr/share/adbyby/rule-update")
+ icount = luci.sys.exec("/usr/share/adbyby/rule-count '/tmp/rules/'")
+
+ if tonumber(icount)>0 then
+ if nixio.fs.access("/usr/share/adbyby/rules/") then
+ oldcount=luci.sys.exec("/usr/share/adbyby/rule-count '/usr/share/adbyby/rules/'")
+ else
+ oldcount=0
+ end
+ else
+ retstring ="-1"
+ end
+
+ if tonumber(icount) ~= tonumber(oldcount) then
+ luci.sys.exec("rm -rf /usr/share/adbyby/rules/* && cp -a /tmp/rules /usr/share/adbyby/")
+ luci.sys.exec("/etc/init.d/dnsmasq reload")
+ retstring=tostring(math.ceil(tonumber(icount)))
+ else
retstring ="0"
+ end
else
-
refresh_cmd="wget-ssl -q --no-check-certificate -O - 'https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt' > /tmp/adnew.conf"
-
sret=luci.sys.call(refresh_cmd .. " 2>/dev/null")
if sret== 0 then
luci.sys.call("/usr/share/adbyby/ad-update")
diff --git a/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua b/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua
index 30f1f4b64..6e1a1d0b7 100644
--- a/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua
+++ b/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/advanced.lua
@@ -7,11 +7,21 @@ if nixio.fs.access("/usr/share/adbyby/dnsmasq.adblock") then
ad_count=tonumber(SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l"))
end
+local rule_count=0
+if nixio.fs.access("/usr/share/adbyby/rules/") then
+rule_count=tonumber(SYS.exec("/usr/share/adbyby/rule-count '/usr/share/adbyby/rules/'"))
+end
+
m = Map("adbyby")
s = m:section(TypedSection, "adbyby")
s.anonymous = true
+o = s:option(Flag, "block_ios")
+o.title = translate("Block Apple iOS OTA update")
+o.default = 0
+o.rmempty = false
+
o = s:option(Flag, "cron_mode")
o.title = translate("Update the rule at 6 a.m. every morning and restart adbyby")
o.default = 0
@@ -22,9 +32,22 @@ o.rawhtml = true
o.template = "adbyby/refresh"
o.value =ad_count .. " " .. translate("Records")
-o = s:option(Flag, "block_ios")
-o.title = translate("Block Apple iOS OTA update")
-o.default = 0
-o.rmempty = false
+o=s:option(DummyValue,"rule_data",translate("Subscribe 3rd Rules Data"))
+o.rawhtml = true
+o.template = "adbyby/refresh"
+o.value =rule_count .. " " .. translate("Records")
+o.description = translate("AdGuardHome / Host / DNSMASQ rules auto-convert")
+
+o = s:option(Button,"delete",translate("Delete All Subscribe Rules"))
+o.inputstyle = "reset"
+o.write = function()
+ SYS.exec("rm -rf /usr/share/adbyby/rules/data/* /usr/share/adbyby/rules/host/*")
+ SYS.exec("mkdir -p /usr/share/adbyby/rules/data/ /usr/share/adbyby/rules/host/")
+ SYS.exec("/etc/init.d/adbyby restart 2>&1 &")
+ luci.http.redirect(luci.dispatcher.build_url("admin", "services", "adbyby", "advanced"))
+end
+
+o = s:option(DynamicList, "subscribe_url", translate("Anti-AD Rules Subscribe"))
+o.rmempty = true
return m
\ No newline at end of file
diff --git a/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/base.lua b/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/base.lua
index d0a382b6f..3081e89e8 100644
--- a/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/base.lua
+++ b/package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby/base.lua
@@ -8,10 +8,9 @@ local DV = SYS.exec("head -1 /tmp/adbyby/data/video.txt | awk -F' ' '{print $3,$
local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l")
local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l")
local UD = NXFS.readfile("/tmp/adbyby.updated") or "1970-01-01 00:00:00"
-local ND = SYS.exec("cat /usr/share/adbyby/dnsmasq.adblock | wc -l")
m = Map("adbyby")
-m.title = translate("Adbyby Plus +")
+m.title = translate("Adbyby Plus + Settings")
m.description = translate("Adbyby Plus + can filter all kinds of banners, popups, video ads, and prevent tracking, privacy theft and a variety of malicious websites
Plus + version combination mode can operation with Adblock Plus Host,filtering ads without losing bandwidth")
m:section(SimpleSection).template = "adbyby/adbyby_status"
diff --git a/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po b/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po
index dd1f32eff..d71ceddd1 100644
--- a/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po
+++ b/package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po
@@ -13,6 +13,9 @@ msgstr "广告屏蔽大师 Plus + 可以全面过滤各种横幅、弹窗、视
msgid "Adbyby Plus +"
msgstr "广告屏蔽大师 Plus+"
+msgid "Adbyby Plus + Settings"
+msgstr "广告屏蔽大师 Plus+(支持 AdGuardHome /Host / DNSMASQ 规则)"
+
msgid "Base Setting"
msgstr "基本设置"
@@ -55,7 +58,6 @@ msgstr "域名黑名单"
msgid "Black IP List"
msgstr "IP黑名单"
-
msgid "Advance Setting"
msgstr "高级设置"
@@ -68,6 +70,18 @@ msgstr "Adblock Plus Hosts 记录数"
msgid "Adblock Plus Data"
msgstr "Adblock Plus 规则数据库"
+msgid "Subscribe 3rd Rules Data"
+msgstr "订阅第三方去广告规则"
+
+msgid "Delete All Subscribe Rules"
+msgstr "清空所有订阅的规则库"
+
+msgid "Anti-AD Rules Subscribe"
+msgstr "广告过滤规则订阅URL"
+
+msgid "AdGuardHome / Host / DNSMASQ rules auto-convert"
+msgstr "AdGuardHome / Host / DNSMASQ 规则自动识别"
+
msgid "Manually force update
Adblock Plus Host List"
msgstr "手动强制更新
Adblock Plus Host List"
diff --git a/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby b/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby
index 08b9ae136..e0fb533ad 100755
--- a/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby
+++ b/package/lean/luci-app-adbyby-plus/root/etc/init.d/adbyby
@@ -110,6 +110,8 @@ add_dns()
awk '!/^$/&&!/^#/{printf("address=/%s/'"0.0.0.0"'\n",$0)}' $PROG_PATH/adblack.conf > /var/etc/dnsmasq-adbyby.d/07-dnsmasq.black
cat > /tmp/dnsmasq.d/dnsmasq-adbyby.conf <> /etc/dnsmasq.conf
+ [ $block_ios -eq 1 ] && echo 'address=/mesu.apple.com/0.0.0.0' >> /tmp/dnsmasq.d/dnsmasq-adbyby.conf
}
del_dns()
diff --git a/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/rule-count b/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/rule-count
new file mode 100755
index 000000000..9f7388738
--- /dev/null
+++ b/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/rule-count
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+find $1 -type f -exec cat {} \; | wc -l
\ No newline at end of file
diff --git a/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/rule-update b/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/rule-update
new file mode 100755
index 000000000..ae13c619a
--- /dev/null
+++ b/package/lean/luci-app-adbyby-plus/root/usr/share/adbyby/rule-update
@@ -0,0 +1,36 @@
+#!/bin/sh -e
+
+url_md5() {
+ echo -n $1|md5sum|cut -d ' ' -f1
+}
+
+convert_rules() {
+mkdir -p /tmp/rules/data
+mkdir -p /tmp/rules/host
+
+wget-ssl -q --no-check-certificate $1 -O /tmp/adnew.conf
+
+rulename=$(url_md5 $1)
+
+if [ -f /tmp/adnew.conf ]; then
+ if (grep -wq "address=" /tmp/adnew.conf) ; then
+ cp /tmp/adnew.conf /tmp/rules/data/$rulename.conf
+ elif (grep -wq -e"0.0.0.0" -e"127.0.0.1" /tmp/adnew.conf) ; then
+ cp /tmp/adnew.conf /tmp/rules/host/$rulename.txt
+ else
+ cat /tmp/adnew.conf | grep ^\|\|[^\*]*\^$ | sed -e 's:||:address\=\/:' -e 's:\^:/0\.0\.0\.0:' > /tmp/rules/data/$rulename.conf
+ fi
+fi
+rm -rf /tmp/adnew.conf
+}
+
+ARRAY=$(uci get adbyby.@adbyby[0].subscribe_url 2> /dev/null)
+
+rm -rf /tmp/rules
+
+i=1
+for j in $ARRAY
+do
+ convert_rules $j
+ i=`expr $i + 1`
+done
\ No newline at end of file