summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-dnscrypt-proxy/luasrc/controller
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2017-08-16 21:49:20 +0200
committerDirk Brenken <dev@brenken.org>2017-08-16 21:49:20 +0200
commit14dca2f3eef863c03b87bf21dc5787a524d84b62 (patch)
tree10750d3a16d8125b375393bbf445c69209afab22 /applications/luci-app-dnscrypt-proxy/luasrc/controller
parentf450c0403d4aa2d1e5cbcb262315121b130990e9 (diff)
luci-app-dnscrypt-proxy: new package
to ease the dnscrypt-proxy configuration I've build this package, main features: * full resolver list handling, incl. list refresh and simple resolver selection per instance * trigger support * support the following (conditional) options: * resolvers_list * ephemeral_keys * blacklist * block_ipv6 * local_cache * query_log_file Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-dnscrypt-proxy/luasrc/controller')
-rw-r--r--applications/luci-app-dnscrypt-proxy/luasrc/controller/dnscrypt-proxy.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/applications/luci-app-dnscrypt-proxy/luasrc/controller/dnscrypt-proxy.lua b/applications/luci-app-dnscrypt-proxy/luasrc/controller/dnscrypt-proxy.lua
new file mode 100644
index 0000000000..6d6790a839
--- /dev/null
+++ b/applications/luci-app-dnscrypt-proxy/luasrc/controller/dnscrypt-proxy.lua
@@ -0,0 +1,32 @@
+-- Copyright 2017 Dirk Brenken (dev@brenken.org)
+-- This is free software, licensed under the Apache License, Version 2.0
+
+module("luci.controller.dnscrypt-proxy", package.seeall)
+
+local util = require("luci.util")
+local i18n = require("luci.i18n")
+local templ = require("luci.template")
+
+function index()
+ if not nixio.fs.access("/etc/config/dnscrypt-proxy") then
+ nixio.fs.writefile("/etc/config/dnscrypt-proxy", "")
+ end
+ entry({"admin", "services", "dnscrypt-proxy"}, firstchild(), _("DNSCrypt-Proxy"), 60).dependent = false
+ entry({"admin", "services", "dnscrypt-proxy", "tab_from_cbi"}, cbi("dnscrypt-proxy/overview_tab", {hideresetbtn=true, hidesavebtn=true}), _("Overview"), 10).leaf = true
+ entry({"admin", "services", "dnscrypt-proxy", "logfile"}, call("logread"), _("View Logfile"), 20).leaf = true
+ entry({"admin", "services", "dnscrypt-proxy", "advanced"}, firstchild(), _("Advanced"), 100)
+ entry({"admin", "services", "dnscrypt-proxy", "advanced", "configuration"}, cbi("dnscrypt-proxy/configuration_tab"), _("Edit DNSCrypt-Proxy Configuration"), 110).leaf = true
+ entry({"admin", "services", "dnscrypt-proxy", "advanced", "cfg_dnsmasq"}, cbi("dnscrypt-proxy/cfg_dnsmasq_tab"), _("Edit Dnsmasq Configuration"), 120).leaf = true
+ entry({"admin", "services", "dnscrypt-proxy", "advanced", "view_reslist"}, call("view_reslist"), _("View Resolver List"), 130).leaf = true
+
+end
+
+function view_reslist()
+ local reslist = util.trim(util.exec("cat /usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv"))
+ templ.render("dnscrypt-proxy/view_reslist", {title = i18n.translate("DNSCrypt-Proxy Resolver List"), content = reslist})
+end
+
+function logread()
+ local logfile = util.trim(util.exec("logread -e 'dnscrypt-proxy'"))
+ templ.render("dnscrypt-proxy/logread", {title = i18n.translate("DNSCrypt-Proxy Logfile"), content = logfile})
+end