diff --git a/luasrc/model/cbi/mosdns/update.lua b/luasrc/model/cbi/mosdns/update.lua index ee88d1e..432955d 100644 --- a/luasrc/model/cbi/mosdns/update.lua +++ b/luasrc/model/cbi/mosdns/update.lua @@ -11,7 +11,7 @@ s.anonymous = true enable = s:option(Flag, "geo_auto_update", translate("Enable Auto Database Update")) 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 o = s:option(ListValue, "geo_update_week_time", translate("Update Cycle")) diff --git a/po/zh-cn/mosdns.po b/po/zh-cn/mosdns.po index b7764ae..f3909b1 100644 --- a/po/zh-cn/mosdns.po +++ b/po/zh-cn/mosdns.po @@ -73,8 +73,8 @@ msgstr "检查并更新" msgid "Enable Auto Database Update" msgstr "启用数据库自动更新" -msgid "Enable Config Update" -msgstr "启用配置文件同步" +msgid "Enable ADList Update" +msgstr "更新广告过滤列表" msgid "Enable AutoConfiguration" msgstr "启用自动化配置" diff --git a/root/etc/config/mosdns b/root/etc/config/mosdns index 4d80be0..f24ade5 100644 --- a/root/etc/config/mosdns +++ b/root/etc/config/mosdns @@ -7,7 +7,7 @@ config mosdns 'mosdns' option geo_update_day_time '2' option redirect '1' option autoconf '1' - option syncconfig '1' + option update_adlist '1' option adblock '0' option configfile './def_config.yaml' option loglv 'error' diff --git a/root/etc/mosdns/library.sh b/root/etc/mosdns/library.sh index 8492050..6bec666 100755 --- a/root/etc/mosdns/library.sh +++ b/root/etc/mosdns/library.sh @@ -19,7 +19,7 @@ getdat() { fi } -get_ADlist() { +get_adlist() { if exist curl; then curl -fSLo "$TMPDIR/$1" "https://raw.cooluc.com/QiuSimons/openwrt-mos/master/dat/$1" else @@ -27,14 +27,6 @@ get_ADlist() { 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() { if [ "$2" == "inactive" ]; then ubus call network.interface.wan status | jsonfilter -e "@['inactive']['dns-server'][$1]" diff --git a/root/etc/mosdns/mosupdater.sh b/root/etc/mosdns/mosupdater.sh index fe8e4a5..3f21f51 100755 --- a/root/etc/mosdns/mosupdater.sh +++ b/root/etc/mosdns/mosupdater.sh @@ -16,18 +16,13 @@ fi cp -rf "$TMPDIR"/* /usr/share/v2ray rm -rf "$TMPDIR" -syncconfig=$(uci -q get mosdns.mosdns.syncconfig) -if [ "$syncconfig" -eq 1 ]; then +update_adlist=$(uci -q get mosdns.mosdns.update_adlist) +if [ "$update_adlist" -eq 1 ]; then 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 rm -rf "$TMPDIR"/serverlist.txt 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 rm -rf /etc/mosdns/serverlist.bak fi