Update AD filter list

This commit is contained in:
sbwml 2022-04-08 04:45:07 +08:00
parent 6167f2594c
commit 32a679b9d2
5 changed files with 8 additions and 21 deletions

View File

@ -11,7 +11,7 @@ s.anonymous = true
enable = s:option(Flag, "geo_auto_update", translate("Enable Auto Database Update")) enable = s:option(Flag, "geo_auto_update", translate("Enable Auto Database Update"))
enable.rmempty = false enable.rmempty = false
enable = s:option(Flag, "syncconfig", translate("Enable Config Update")) enable = s:option(Flag, "update_adlist", translate("Enable ADList Update"))
enable.rmempty = false enable.rmempty = false
o = s:option(ListValue, "geo_update_week_time", translate("Update Cycle")) o = s:option(ListValue, "geo_update_week_time", translate("Update Cycle"))

View File

@ -73,8 +73,8 @@ msgstr "检查并更新"
msgid "Enable Auto Database Update" msgid "Enable Auto Database Update"
msgstr "启用数据库自动更新" msgstr "启用数据库自动更新"
msgid "Enable Config Update" msgid "Enable ADList Update"
msgstr "启用配置文件同步" msgstr "更新广告过滤列表"
msgid "Enable AutoConfiguration" msgid "Enable AutoConfiguration"
msgstr "启用自动化配置" msgstr "启用自动化配置"

View File

@ -7,7 +7,7 @@ config mosdns 'mosdns'
option geo_update_day_time '2' option geo_update_day_time '2'
option redirect '1' option redirect '1'
option autoconf '1' option autoconf '1'
option syncconfig '1' option update_adlist '1'
option adblock '0' option adblock '0'
option configfile './def_config.yaml' option configfile './def_config.yaml'
option loglv 'error' option loglv 'error'

View File

@ -19,7 +19,7 @@ getdat() {
fi fi
} }
get_ADlist() { get_adlist() {
if exist curl; then if exist curl; then
curl -fSLo "$TMPDIR/$1" "https://raw.cooluc.com/QiuSimons/openwrt-mos/master/dat/$1" curl -fSLo "$TMPDIR/$1" "https://raw.cooluc.com/QiuSimons/openwrt-mos/master/dat/$1"
else else
@ -27,14 +27,6 @@ get_ADlist() {
fi fi
} }
get_config() {
if exist curl; then
curl -fSLo "$TMPDIR/$1" "https://raw.cooluc.com/sbwml/luci-app-mosdns/master/root/etc/mosdns/$1"
else
wget "https://raw.cooluc.com/sbwml/luci-app-mosdns/master/root/etc/mosdns/$1" -nv -O "$TMPDIR/$1"
fi
}
getdns() { getdns() {
if [ "$2" == "inactive" ]; then if [ "$2" == "inactive" ]; then
ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]" ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]"

View File

@ -16,18 +16,13 @@ fi
cp -rf "$TMPDIR"/* /usr/share/v2ray cp -rf "$TMPDIR"/* /usr/share/v2ray
rm -rf "$TMPDIR" rm -rf "$TMPDIR"
syncconfig=$(uci -q get mosdns.mosdns.syncconfig) update_adlist=$(uci -q get mosdns.mosdns.update_adlist)
if [ "$syncconfig" -eq 1 ]; then if [ "$update_adlist" -eq 1 ]; then
TMPDIR=$(mktemp -d) || exit 2 TMPDIR=$(mktemp -d) || exit 2
get_config def_config.yaml get_adlist serverlist.txt
get_ADlist serverlist.txt
if [ "$(grep -o .com "$TMPDIR"/serverlist.txt | wc -l)" -lt "1000" ]; then if [ "$(grep -o .com "$TMPDIR"/serverlist.txt | wc -l)" -lt "1000" ]; then
rm -rf "$TMPDIR"/serverlist.txt rm -rf "$TMPDIR"/serverlist.txt
fi fi
if [ "$(grep -o plugin "$TMPDIR"/def_config.yaml | wc -l)" -eq "0" ]; then
rm -rf "$TMPDIR"/def_config.yaml
fi
cp -rf "$TMPDIR"/* /etc/mosdns cp -rf "$TMPDIR"/* /etc/mosdns
rm -rf /etc/mosdns/serverlist.bak rm -rf /etc/mosdns/serverlist.bak
fi fi