diff options
author | Eric Luehrsen <ericluehrsen@hotmail.com> | 2017-09-17 23:31:15 -0400 |
---|---|---|
committer | Eric Luehrsen <ericluehrsen@hotmail.com> | 2017-09-22 23:04:40 -0400 |
commit | 7ca169710e048f2e3a5d3a1ad3dbc96c666e03a7 (patch) | |
tree | 7ebc3ef99f72c3ed078ba563afceeee127ada4f6 /applications/luci-app-unbound/luasrc/controller/unbound.lua | |
parent | 678c15c0da5e9a133522dc66baafc088dcef5543 (diff) |
luci-app-unbound: clean up presentation of advanced LuCI tabs
Add CSS for editing tabs to provide monospace font and offset
editing window color from read only windows. Expand 'control'
option to match with net/unbound. Add 'extended_stats' option
to match with net/unbound.
Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
Diffstat (limited to 'applications/luci-app-unbound/luasrc/controller/unbound.lua')
-rw-r--r-- | applications/luci-app-unbound/luasrc/controller/unbound.lua | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/applications/luci-app-unbound/luasrc/controller/unbound.lua b/applications/luci-app-unbound/luasrc/controller/unbound.lua index 296d020cdb..b44bf038eb 100644 --- a/applications/luci-app-unbound/luasrc/controller/unbound.lua +++ b/applications/luci-app-unbound/luasrc/controller/unbound.lua @@ -8,7 +8,7 @@ module("luci.controller.unbound", package.seeall) function index() local ucl = luci.model.uci.cursor() - local valexp = ucl:get_first("unbound", "unbound", "luci_expanded") + local valexp = ucl:get_first("unbound", "unbound", "extended_luci") local valman = ucl:get_first("unbound", "unbound", "manual_conf") @@ -89,7 +89,7 @@ end function QueryStatistics() local lclhead = "Unbound Control Stats" local lcldata = luci.util.exec("unbound-control -c /var/lib/unbound/unbound.conf stats_noreset") - local lcldesc = luci.i18n.translate("This shows some performances statistics tracked by Unbound.") + local lcldesc = luci.i18n.translate("This shows some performance statistics tracked by Unbound.") luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) end @@ -97,7 +97,7 @@ end function QueryLocalData() local lclhead = "Unbound Control Local Data" local lcldata = luci.util.exec("unbound-control -c /var/lib/unbound/unbound.conf list_local_data") - local lcldesc = luci.i18n.translate("This shows local RR including this router, DHCP assignments, and RFC1918 SOA stubs.") + local lcldesc = luci.i18n.translate("This shows local host records that shortcut recursion.") luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) end @@ -105,31 +105,47 @@ end function QueryLocalZone() local lclhead = "Unbound Control Local Zones" local lcldata = luci.util.exec("unbound-control -c /var/lib/unbound/unbound.conf list_local_zones") - local lcldesc = luci.i18n.translate("This shows local zones including LAN, adblock, forwarding, and RFC1918 in-arpa. ") + local lcldesc = luci.i18n.translate("This shows local zone definitions that affect recursion routing or processing. ") luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) end function ShowUnboundConf() + local unboundfile = "/var/lib/unbound/unbound.conf" local lclhead = "Unbound Conf" - local lcldata = luci.util.exec("cat /var/lib/unbound/unbound.conf") - local lcldesc = luci.i18n.translate("This shows '/var/lib/unbound/unbound.conf' generated by UCI.") + local lcldata = nixio.fs.readfile(unboundfile) + local lcldesc = luci.i18n.translate("This shows configuration generated by UCI:") + lcldesc = lcldesc .. " (" .. unboundfile .. ")" luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) end function ShowDHCPConf() + local dhcpfile = "/var/lib/unbound/unbound_dhcp.conf" local lclhead = "DHCP Conf" - local lcldata = luci.util.exec("cat /var/lib/unbound/unbound_dhcp.conf") - local lcldesc = luci.i18n.translate("This shows '/var/lib/unbound/unbound_dhcp.conf' generated by DHCP hook script(s).") + local lcldata = nixio.fs.readfile(dhcpfile) + local lcldesc = luci.i18n.translate("This shows LAN hosts added by DHCP hook scripts:") + lcldesc = lcldesc .. " (" .. dhcpfile .. ")" luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) end function ShowAdblock() + local adblockfile = "/var/lib/unbound/adb_list.overall" local lclhead = "Adblock Conf" - local lcldata = luci.util.exec("cat /var/lib/unbound/adb_list.overall") - local lcldesc = luci.i18n.translate("This shows '/var/lib/unbound/adb_list.overall' provided by Adblock script(s).") - luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) + local lcldata, lcldesc + + + if nixio.fs.stat(adblockfile).size > 262144 then + lcldesc = luci.i18n.translate("Adblock domain list is too large for LuCI:") + lcldesc = lcldesc .. " (" .. adblockfile .. ")" + luci.template.render("unbound/show-empty", {heading = lclhead, description = lcldesc}) + + else + lcldata = nixio.fs.readfile(adblockfile) + lcldesc = luci.i18n.translate("This shows blocked domains provided by Adblock scripts:") + lcldesc = lcldesc .. " (" .. adblockfile .. ")" + luci.template.render("unbound/show-textbox", {heading = lclhead, description = lcldesc, content = lcldata}) + end end |