drop DNS helper
This commit is contained in:
parent
043f7127fc
commit
73e884fa45
@ -59,25 +59,8 @@ adblock = s:option(Flag, "adblock", translate("Enable DNS ADblock"))
|
|||||||
adblock:depends( "configfile", "./def_config.yaml")
|
adblock:depends( "configfile", "./def_config.yaml")
|
||||||
adblock.default = true
|
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 = s:option(TextValue, "manual-config")
|
||||||
config.description = translate("<font color=\"ff0000\"><strong>View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need.")
|
config.description = translate("<font color=\"ff0000\"><strong>View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need.</strong></font>")
|
||||||
config.template = "cbi/tvalue"
|
config.template = "cbi/tvalue"
|
||||||
config.rows = 25
|
config.rows = 25
|
||||||
config:depends( "configfile", "./cus_config.yaml")
|
config:depends( "configfile", "./cus_config.yaml")
|
||||||
|
@ -7,7 +7,7 @@ s.addremove = false
|
|||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
|
|
||||||
config = s:option(TextValue, "whitelist")
|
config = s:option(TextValue, "whitelist")
|
||||||
config.description = translate("<font color=\"ff0000\"><strong>ADblock whitelist.")
|
config.description = translate("<font color=\"ff0000\"><strong>ADblock whitelist.</strong></font>")
|
||||||
config.template = "cbi/tvalue"
|
config.template = "cbi/tvalue"
|
||||||
config.rows = 25
|
config.rows = 25
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@ msgstr "启用 DNS 重定向"
|
|||||||
msgid "Enable DNS ADblock"
|
msgid "Enable DNS ADblock"
|
||||||
msgstr "启用 DNS 广告过滤"
|
msgstr "启用 DNS 广告过滤"
|
||||||
|
|
||||||
msgid "<font color=\"ff0000\"><strong>View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need."
|
msgid "<font color=\"ff0000\"><strong>View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need.</strong></font>"
|
||||||
msgstr "<font color=\"ff0000\"><strong>注意!此页的更改仅当 'MosDNS 配置文件选择' 为 '自定义配置' 时才会生效"
|
msgstr "<font color=\"ff0000\"><strong>注意!此页的更改仅当 'MosDNS 配置文件选择' 为 '自定义配置' 时才会生效</strong></font>"
|
||||||
|
|
||||||
msgid "<font color=\"ff0000\"><strong>ADblock whitelist."
|
msgid "<font color=\"ff0000\"><strong>ADblock whitelist.</strong></font>"
|
||||||
msgstr "<font color=\"ff0000\"><strong>广告过滤白名单"
|
msgstr "<font color=\"ff0000\"><strong>广告过滤白名单</strong></font>"
|
||||||
|
|
||||||
msgid "ADblock whitelist"
|
msgid "ADblock whitelist"
|
||||||
msgstr "白名单"
|
msgstr "白名单"
|
||||||
@ -76,24 +76,6 @@ msgstr "检查并更新"
|
|||||||
msgid "Enable Auto Database Update"
|
msgid "Enable Auto Database Update"
|
||||||
msgstr "启用数据库自动更新"
|
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"
|
msgid "MosDNS Config File"
|
||||||
msgstr "MosDNS 配置文件选择"
|
msgstr "MosDNS 配置文件选择"
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ inital_conf() {
|
|||||||
config_load "mosdns"
|
config_load "mosdns"
|
||||||
config_get "enabled" "mosdns" "enabled" "0"
|
config_get "enabled" "mosdns" "enabled" "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
procd_add_reload_trigger "mosdns"
|
procd_add_reload_trigger "mosdns"
|
||||||
}
|
}
|
||||||
@ -27,7 +28,7 @@ restore_setting() {
|
|||||||
uci commit dhcp
|
uci commit dhcp
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_setting() {
|
redirect_setting() {
|
||||||
redirect=$(uci -q get mosdns.mosdns.redirect)
|
redirect=$(uci -q get mosdns.mosdns.redirect)
|
||||||
if [ "$redirect" -eq 1 ]; then
|
if [ "$redirect" -eq 1 ]; then
|
||||||
sed -i "/list server/d" /etc/config/dhcp
|
sed -i "/list server/d" /etc/config/dhcp
|
||||||
@ -39,7 +40,7 @@ prepare_setting() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
restart_others() {
|
reload_others() {
|
||||||
/etc/init.d/network reload
|
/etc/init.d/network reload
|
||||||
/etc/init.d/dnsmasq reload
|
/etc/init.d/dnsmasq reload
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ start_service() {
|
|||||||
if [ "$enabled" -eq 0 ]; then
|
if [ "$enabled" -eq 0 ]; then
|
||||||
firstblood=$(uci -q get mosdns.mosdns.not_first_start)
|
firstblood=$(uci -q get mosdns.mosdns.not_first_start)
|
||||||
[ "${firstblood}" = "0" ] && restore_setting
|
[ "${firstblood}" = "0" ] && restore_setting
|
||||||
[ "${firstblood}" = "0" ] && restart_others
|
[ "${firstblood}" = "0" ] && reload_others
|
||||||
uci set mosdns.mosdns.not_first_start='1'
|
uci set mosdns.mosdns.not_first_start='1'
|
||||||
uci commit mosdns
|
uci commit mosdns
|
||||||
echo "MosDNS has turned off"
|
echo "MosDNS has turned off"
|
||||||
@ -88,15 +89,8 @@ start_service() {
|
|||||||
configfile=$(uci -q get mosdns.mosdns.configfile)
|
configfile=$(uci -q get mosdns.mosdns.configfile)
|
||||||
if [ "${configfile}" = "./def_config.yaml" ]; then
|
if [ "${configfile}" = "./def_config.yaml" ]; then
|
||||||
restore_setting
|
restore_setting
|
||||||
prepare_setting
|
redirect_setting
|
||||||
if [ "$(uci -q get mosdns.mosdns.redirect)" -eq 1 ] && [ "$(uci -q get shadowsocksr.@global[0].run_mode)" != gfw ]; then
|
reload_others
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "MosDNS turn on"
|
echo "MosDNS turn on"
|
||||||
@ -115,7 +109,7 @@ stop_service() {
|
|||||||
config_load "mosdns"
|
config_load "mosdns"
|
||||||
enabled=$(uci -q get mosdns.mosdns.enabled)
|
enabled=$(uci -q get mosdns.mosdns.enabled)
|
||||||
[ "${enabled}" = "0" ] && restore_setting
|
[ "${enabled}" = "0" ] && restore_setting
|
||||||
restart_others
|
reload_others
|
||||||
fi
|
fi
|
||||||
delcron
|
delcron
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
bakdns() {
|
bakdns() {
|
||||||
if [ "$1" == "0" ]; then
|
if [ "$1" == "0" ]; then
|
||||||
echo "119.29.29.29"
|
echo "119.29.29.29"
|
||||||
@ -30,14 +31,3 @@ getdns() {
|
|||||||
pid() {
|
pid() {
|
||||||
pgrep -f "$1"
|
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
|
|
||||||
}
|
|
||||||
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user