From d0bc3aa743d93a660282a70af4d6bd47d1b4d57c Mon Sep 17 00:00:00 2001 From: sbwml Date: Thu, 14 Jul 2022 13:24:39 +0800 Subject: [PATCH] luci-app-mosdns: Customize the configuration edit page to add a reload mosdns button --- luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua | 6 ++++++ luci-app-mosdns/po/zh-cn/mosdns.po | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua index dece0c8..d53cacb 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/basic.lua @@ -88,6 +88,12 @@ adblock = s:option(Flag, "adblock", translate("Enable DNS ADblock")) adblock:depends( "configfile", "/etc/mosdns/config.yaml") adblock.default = false +reload_service = s:option( Button, "_reload", translate("Reload Service"), translate("Reload service to take effect of new configuration")) +reload_service.write = function() + luci.sys.exec("/etc/init.d/mosdns reload") +end +reload_service:depends( "configfile", "/etc/mosdns/config_custom.yaml") + 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.template = "cbi/tvalue" diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index 4b26958..01fc36b 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -28,6 +28,12 @@ msgstr "将 Dnsmasq 域名解析请求转发到 MosDNS 服务器" msgid "Enable DNS ADblock" msgstr "启用 DNS 广告过滤" +msgid "Reload Service" +msgstr "重载服务" + +msgid "Reload service to take effect of new configuration" +msgstr "重载 MosDNS 服务生效配置文件" + msgid "View the Custom YAML Configuration file used by this MosDNS. You can edit it as you own need." msgstr "注意!此页的更改仅当配置文件为 “自定义” 时才会生效"