2
0

https-dns-proxy.lua 968 B

123456789101112131415161718192021222324252627
  1. module("luci.controller.https-dns-proxy", package.seeall)
  2. function index()
  3. if nixio.fs.access("/etc/config/https-dns-proxy") then
  4. entry({"admin", "services", "https-dns-proxy"}, cbi("https-dns-proxy"), _("DNS HTTPS Proxy")).acl_depends = { "luci-app-https-dns-proxy" }
  5. entry({"admin", "services", "https-dns-proxy", "action"}, call("https_dns_proxy_action"), nil).leaf = true
  6. end
  7. end
  8. function https_dns_proxy_action(name)
  9. local packageName = "https-dns-proxy"
  10. local http = require "luci.http"
  11. local sys = require "luci.sys"
  12. local util = require "luci.util"
  13. if name == "start" then
  14. sys.init.start(packageName)
  15. elseif name == "action" then
  16. util.exec("/etc/init.d/" .. packageName .. " reload >/dev/null 2>&1")
  17. elseif name == "stop" then
  18. sys.init.stop(packageName)
  19. elseif name == "enable" then
  20. sys.init.enable(packageName)
  21. elseif name == "disable" then
  22. sys.init.disable(packageName)
  23. end
  24. http.prepare_content("text/plain")
  25. http.write("0")
  26. end