2019-12-19 18:19:59 +00:00
|
|
|
module("luci.controller.https-dns-proxy", package.seeall)
|
2018-08-23 22:11:49 +00:00
|
|
|
function index()
|
2019-12-19 18:19:59 +00:00
|
|
|
if nixio.fs.access("/etc/config/https-dns-proxy") then
|
2020-04-24 10:05:45 +00:00
|
|
|
entry({"admin", "services", "https-dns-proxy"}, cbi("https-dns-proxy"), _("DNS HTTPS Proxy")).acl_depends = { "luci-app-https-dns-proxy" }
|
2019-12-19 18:19:59 +00:00
|
|
|
entry({"admin", "services", "https-dns-proxy", "action"}, call("https_dns_proxy_action"), nil).leaf = true
|
2018-08-23 22:11:49 +00:00
|
|
|
end
|
2019-11-13 11:25:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function https_dns_proxy_action(name)
|
2019-12-19 18:19:59 +00:00
|
|
|
local packageName = "https-dns-proxy"
|
2020-12-21 17:34:24 +00:00
|
|
|
local http = require "luci.http"
|
|
|
|
local sys = require "luci.sys"
|
|
|
|
local util = require "luci.util"
|
2019-11-13 11:25:53 +00:00
|
|
|
if name == "start" then
|
2020-12-21 17:34:24 +00:00
|
|
|
sys.init.start(packageName)
|
2019-11-13 11:25:53 +00:00
|
|
|
elseif name == "action" then
|
2020-12-21 17:34:24 +00:00
|
|
|
util.exec("/etc/init.d/" .. packageName .. " reload >/dev/null 2>&1")
|
2019-11-13 11:25:53 +00:00
|
|
|
elseif name == "stop" then
|
2020-12-21 17:34:24 +00:00
|
|
|
sys.init.stop(packageName)
|
2019-11-13 11:25:53 +00:00
|
|
|
elseif name == "enable" then
|
2020-12-21 17:34:24 +00:00
|
|
|
sys.init.enable(packageName)
|
2019-11-13 11:25:53 +00:00
|
|
|
elseif name == "disable" then
|
2020-12-21 17:34:24 +00:00
|
|
|
sys.init.disable(packageName)
|
2019-11-13 11:25:53 +00:00
|
|
|
end
|
2020-12-21 17:34:24 +00:00
|
|
|
http.prepare_content("text/plain")
|
|
|
|
http.write("0")
|
2018-08-23 22:11:49 +00:00
|
|
|
end
|