From 5a81e4f6c1d556de3d7fbdabfc68ba6a1429dcfc Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Wed, 13 Nov 2019 04:25:53 -0700 Subject: luci-app-https_dns_proxy: remove dnsmasq integration, better service controls, providers as plugins, misc fixes Signed-off-by: Stan Grishin --- .../luasrc/controller/https_dns_proxy.lua | 24 +++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'applications/luci-app-https_dns_proxy/luasrc/controller') diff --git a/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua b/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua index e1fd8fcb9b..826f3f691f 100644 --- a/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua +++ b/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua @@ -1,7 +1,25 @@ module("luci.controller.https_dns_proxy", package.seeall) function index() - if not nixio.fs.access("/etc/config/https_dns_proxy") then - return + if nixio.fs.access("/etc/config/https_dns_proxy") then + entry({"admin", "services", "https_dns_proxy"}, cbi("https_dns_proxy"), _("DNS over HTTPS Proxy")) + entry({"admin", "services", "https_dns_proxy", "action"}, call("https_dns_proxy_action"), nil).leaf = true end - entry({"admin", "services", "https_dns_proxy"}, cbi("https_dns_proxy"), _("HTTPS DNS Proxy")) +end + +function https_dns_proxy_action(name) + local packageName = "https_dns_proxy" + if name == "start" then + luci.sys.init.start(packageName) + elseif name == "action" then + luci.util.exec("/etc/init.d/" .. packageName .. " reload >/dev/null 2>&1") + luci.util.exec("/etc/init.d/dnsmasq restart >/dev/null 2>&1") + elseif name == "stop" then + luci.sys.init.stop(packageName) + elseif name == "enable" then + luci.sys.init.enable(packageName) + elseif name == "disable" then + luci.sys.init.disable(packageName) + end + luci.http.prepare_content("text/plain") + luci.http.write("0") end -- cgit v1.2.3