X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=applications%2Fluci-app-unbound%2Fluasrc%2Fcontroller%2Funbound.lua;h=b44bf038eb5a7060e33ac039909deae8b479c2cf;hb=2d011a5e9794ddb7e001e7bc2bda15c2942b0db5;hp=296d020cdbf8a4abb1d4883db87cd8c25278eda2;hpb=007b28ddb30b9617f6c2eab40cbc7e614d7595ac;p=project%2Fluci.git diff --git a/applications/luci-app-unbound/luasrc/controller/unbound.lua b/applications/luci-app-unbound/luasrc/controller/unbound.lua index 296d020cd..b44bf038e 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