From 73e884fa45f5a7662d87f7850c0916fd1dd65fbe Mon Sep 17 00:00:00 2001 From: sbwml Date: Sat, 9 Apr 2022 08:45:28 +0800 Subject: [PATCH] drop DNS helper --- luasrc/model/cbi/mosdns/basic.lua | 19 +---------- luasrc/model/cbi/mosdns/whitelist.lua | 2 +- po/zh-cn/mosdns.po | 26 +++------------ root/etc/init.d/mosdns | 20 ++++-------- root/etc/mosdns/library.sh | 12 +------ root/etc/mosdns/set.sh | 47 --------------------------- 6 files changed, 14 insertions(+), 112 deletions(-) delete mode 100755 root/etc/mosdns/set.sh diff --git a/luasrc/model/cbi/mosdns/basic.lua b/luasrc/model/cbi/mosdns/basic.lua index 716838b..4a04b38 100644 --- a/luasrc/model/cbi/mosdns/basic.lua +++ b/luasrc/model/cbi/mosdns/basic.lua @@ -59,25 +59,8 @@ adblock = s:option(Flag, "adblock", translate("Enable DNS ADblock")) adblock:depends( "configfile", "./def_config.yaml") adblock.default = true -set_config = s:option(Button, "set_config", translate("DNS Helper")) -set_config.inputtitle = translate("Apply") -set_config.inputstyle = "reload" -set_config.description = translate("This will make the necessary adjustments to other plug-in settings.") -set_config.write = function() - luci.sys.exec("/etc/mosdns/set.sh &> /dev/null &") -end -set_config:depends( "configfile", "./def_config.yaml") - -unset_config = s:option(Button, "unset_config", translate("Revert Settings")) -unset_config.inputtitle = translate("Apply") -unset_config.inputstyle = "reload" -unset_config.description = translate("This will revert the adjustments.") -unset_config.write = function() - luci.sys.exec("/etc/mosdns/set.sh unset &> /dev/null &") -end - config = s:option(TextValue, "manual-config") -config.description = translate("View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need.") +config.description = translate("View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need.") config.template = "cbi/tvalue" config.rows = 25 config:depends( "configfile", "./cus_config.yaml") diff --git a/luasrc/model/cbi/mosdns/whitelist.lua b/luasrc/model/cbi/mosdns/whitelist.lua index 393127f..993cfba 100644 --- a/luasrc/model/cbi/mosdns/whitelist.lua +++ b/luasrc/model/cbi/mosdns/whitelist.lua @@ -7,7 +7,7 @@ s.addremove = false s.anonymous = true config = s:option(TextValue, "whitelist") -config.description = translate("ADblock whitelist.") +config.description = translate("ADblock whitelist.") config.template = "cbi/tvalue" config.rows = 25 diff --git a/po/zh-cn/mosdns.po b/po/zh-cn/mosdns.po index b3031a6..0be743d 100644 --- a/po/zh-cn/mosdns.po +++ b/po/zh-cn/mosdns.po @@ -25,11 +25,11 @@ msgstr "启用 DNS 重定向" msgid "Enable DNS ADblock" msgstr "启用 DNS 广告过滤" -msgid "View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need." -msgstr "注意!此页的更改仅当 'MosDNS 配置文件选择' 为 '自定义配置' 时才会生效" +msgid "View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need." +msgstr "注意!此页的更改仅当 'MosDNS 配置文件选择' 为 '自定义配置' 时才会生效" -msgid "ADblock whitelist." -msgstr "广告过滤白名单" +msgid "ADblock whitelist." +msgstr "广告过滤白名单" msgid "ADblock whitelist" msgstr "白名单" @@ -76,24 +76,6 @@ msgstr "检查并更新" msgid "Enable Auto Database Update" msgstr "启用数据库自动更新" -msgid "Enable AutoConfiguration" -msgstr "启用自动化配置" - -msgid "This will make the necessary adjustments to other plug-in settings." -msgstr "对其他插件的设置进行必要的设置,目前仅支持 SSRP VSSR PASSWALL。" - -msgid "This will revert the adjustments." -msgstr "还原设置助手对其他插件进行的配置设定。" - -msgid "DNS Helper" -msgstr "DNS 设置助手" - -msgid "Revert Settings" -msgstr "DNS 设置还原" - -msgid "Apply" -msgstr "应用" - msgid "MosDNS Config File" msgstr "MosDNS 配置文件选择" diff --git a/root/etc/init.d/mosdns b/root/etc/init.d/mosdns index 52d2e55..c72aa5f 100755 --- a/root/etc/init.d/mosdns +++ b/root/etc/init.d/mosdns @@ -16,6 +16,7 @@ inital_conf() { config_load "mosdns" config_get "enabled" "mosdns" "enabled" "0" } + service_triggers() { procd_add_reload_trigger "mosdns" } @@ -27,7 +28,7 @@ restore_setting() { uci commit dhcp } -prepare_setting() { +redirect_setting() { redirect=$(uci -q get mosdns.mosdns.redirect) if [ "$redirect" -eq 1 ]; then sed -i "/list server/d" /etc/config/dhcp @@ -39,7 +40,7 @@ prepare_setting() { fi } -restart_others() { +reload_others() { /etc/init.d/network reload /etc/init.d/dnsmasq reload } @@ -69,7 +70,7 @@ start_service() { if [ "$enabled" -eq 0 ]; then firstblood=$(uci -q get mosdns.mosdns.not_first_start) [ "${firstblood}" = "0" ] && restore_setting - [ "${firstblood}" = "0" ] && restart_others + [ "${firstblood}" = "0" ] && reload_others uci set mosdns.mosdns.not_first_start='1' uci commit mosdns echo "MosDNS has turned off" @@ -88,15 +89,8 @@ start_service() { configfile=$(uci -q get mosdns.mosdns.configfile) if [ "${configfile}" = "./def_config.yaml" ]; then restore_setting - prepare_setting - if [ "$(uci -q get mosdns.mosdns.redirect)" -eq 1 ] && [ "$(uci -q get shadowsocksr.@global[0].run_mode)" != gfw ]; then - cat /dev/null > /etc/ssrplus/gfw_list.conf - sed -i '/update.lua/d' /usr/share/shadowsocksr/ssrplusupdate.sh - sed -i '/bin\/sh/a\/usr/bin/lua /usr/share/shadowsocksr/update.lua ad_data' /usr/share/shadowsocksr/ssrplusupdate.sh - sed -i '/bin\/sh/a\/usr/bin/lua /usr/share/shadowsocksr/update.lua nfip_data' /usr/share/shadowsocksr/ssrplusupdate.sh - sed -i '/bin\/sh/a\/usr/bin/lua /usr/share/shadowsocksr/update.lua ip_data' /usr/share/shadowsocksr/ssrplusupdate.sh - fi - restart_others + redirect_setting + reload_others fi echo "MosDNS turn on" @@ -115,7 +109,7 @@ stop_service() { config_load "mosdns" enabled=$(uci -q get mosdns.mosdns.enabled) [ "${enabled}" = "0" ] && restore_setting - restart_others + reload_others fi delcron diff --git a/root/etc/mosdns/library.sh b/root/etc/mosdns/library.sh index 1490393..8f5146a 100755 --- a/root/etc/mosdns/library.sh +++ b/root/etc/mosdns/library.sh @@ -1,4 +1,5 @@ #!/bin/bash -e + bakdns() { if [ "$1" == "0" ]; then echo "119.29.29.29" @@ -30,14 +31,3 @@ getdns() { pid() { pgrep -f "$1" } - - -L_exist() { - if [ "$1" == "ssrp" ]; then - uci get shadowsocksr.@global[0].global_server &>/dev/null - elif [ "$1" == "pw" ]; then - uci get passwall.@global[0].enabled &>/dev/null - elif [ "$1" == "vssr" ]; then - uci get vssr.@global[0].global_server &>/dev/null - fi -} diff --git a/root/etc/mosdns/set.sh b/root/etc/mosdns/set.sh deleted file mode 100755 index 4c7300d..0000000 --- a/root/etc/mosdns/set.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -e -# shellcheck source=/etc/mosdns/library.sh - -source /etc/mosdns/library.sh - -if L_exist ssrp; then - if [ "$1" = "unset" ]; then - uci set shadowsocksr.@global[0].pdnsd_enable='1' - uci set shadowsocksr.@global[0].tunnel_forward='8.8.4.4:53' - elif [ "$1" = "" ]; then - uci set shadowsocksr.@global[0].pdnsd_enable='0' - uci del shadowsocksr.@global[0].tunnel_forward - fi - uci commit shadowsocksr - if [ "$(pid ssrplus)" ]; then - /etc/init.d/shadowsocksr restart - fi -fi -if L_exist pw; then - if [ "$1" = "unset" ]; then - uci set passwall.@global[0].dns_mode='pdnsd' - uci set passwall.@global[0].dns_forward='8.8.4.4' - uci set passwall.@global[0].dns_cache='1' - uci set passwall.@global[0].chinadns_ng='1' - elif [ "$1" = "" ]; then - uci set passwall.@global[0].dns_mode='udp' - uci set passwall.@global[0].dns_forward='127.0.0.1:5335' - uci del passwall.@global[0].dns_cache - uci set passwall.@global[0].chinadns_ng='0' - fi - uci commit passwall - if [ "$(pid passwall)" ]; then - /etc/init.d/passwall restart - fi -fi -if L_exist vssr; then - if [ "$1" = "unset" ]; then - uci set vssr.@global[0].pdnsd_enable='1' - elif [ "$1" = "" ]; then - uci set vssr.@global[0].pdnsd_enable='0' - fi - uci commit vssr - if [ "$(pid vssr)" ]; then - /etc/init.d/vssr restart - fi -fi -exit 0