update adbyby plus,fix restart butoon issue. add an option to update rules from github or adbyby website

This commit is contained in:
coolsnowwolf 2017-09-29 12:46:11 +08:00
parent bf30031971
commit e7d5df4f0b
4 changed files with 24 additions and 6 deletions

View File

@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +coreutils +coreutils-nohup +dnsmasq-full
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-adbyby-plus
PKG_VERSION:=2.0
PKG_RELEASE:=19
PKG_RELEASE:=20
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -70,7 +70,8 @@ o.description = translate(string.format("%s<br /><br />", Status))
o.description = translate(string.format("<strong>Lazy Rule</strong>%s <strong>&nbsp;&nbsp;Video Rule</strong>%s<br /><strong>Third Party Subscription Rule</strong>%d lines&nbsp;&nbsp;<strong>User-defined Rule</strong>%d lines", DL, DV, math.abs(NR-NU), NR))
o.inputstyle = "reload"
o.write = function()
SYS.call("/etc/init.d/adbyby restart")
SYS.call("nohup sh /usr/share/adbyby/adupdate.sh > /tmp/adupdate.log 2>&1 &")
SYS.call("sleep 4")
HTTP.redirect(DISP.build_url("admin", "services", "adbyby"))
end
@ -82,7 +83,6 @@ o.default = 0
o.rmempty = false
o.description = translate(string.format("<strong><font color=blue>Adblock Plus Host List</font></strong> %s Lines<br /><br />", ND))
updatead = s:taboption("advanced", Button, "updatead", translate("Manually force update<br />Adblock Plus Host List"), translate("Note: It needs to download and convert the rules. The background process may takes 60-120 seconds to run. <br / > After completed it would automatically refresh, please do not duplicate click!"))
updatead.inputtitle = translate("Manually force update")
updatead.inputstyle = "apply"
@ -90,6 +90,11 @@ updatead.write = function()
SYS.call("nohup sh /usr/share/adbyby/adblock.sh > /tmp/adupdate.log 2>&1 &")
end
o = s:taboption("advanced", Flag, "update_source")
o.title = translate("Update adbyby rules form official website first")
o.default = 1
o.rmempty = false
o = s:taboption("advanced", Flag, "block_ios")
o.title = translate("Block Apple iOS OTA update")
o.default = 0

View File

@ -114,5 +114,12 @@ msgstr "<strong><font color=blue>Adblock Plus Host 列表:</font></strong>"
msgid "Note: It needs to download and convert the rules. The background process may takes 60-120 seconds to run. <br / > After completed it would automatically refresh, please do not duplicate click!"
msgstr "注意需要下载并转换规则。后台进程可能需要60-120秒运行。完成后会自动刷新请不要重复点击"
msgid "No filter"
msgstr "不过滤"
msgid "Global filter"
msgstr "全局过滤"
msgid "Update adbyby rules form official website first"
msgstr "优先从官方网站更新规则"

View File

@ -1,8 +1,14 @@
#!/bin/sh
wget -t 1 -T 10 -O /tmp/lazy.txt http://update.adbyby.com/rule3/lazy.jpg
wget -t 1 -T 10 -O /tmp/video.txt http://update.adbyby.com/rule3/video.jpg
wget -t 1 -T 10 -O /tmp/user.action http://update.adbyby.com/rule3/user.action
update_source=$(uci get adbyby.@adbyby[0].update_source 2>/dev/null)
rm -f /usr/share/adbyby/data/*.bak
if [ $update_source -eq 1 ]; then
wget -t 1 -T 10 -O /tmp/lazy.txt http://update.adbyby.com/rule3/lazy.jpg
wget -t 1 -T 10 -O /tmp/video.txt http://update.adbyby.com/rule3/video.jpg
wget -t 1 -T 10 -O /tmp/user.action http://update.adbyby.com/rule3/user.action
fi
[ ! -s "/tmp/lazy.txt" ] && wget --no-check-certificate -O /tmp/lazy.txt https://raw.githubusercontent.com/adbyby/xwhyc-rules/master/lazy.txt
[ ! -s "/tmp/video.txt" ] && wget --no-check-certificate -O /tmp/video.txt https://raw.githubusercontent.com/adbyby/xwhyc-rules/master/video.txt