summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-unbound/luasrc/model/cbi/unbound
diff options
context:
space:
mode:
authorEric Luehrsen <ericluehrsen@hotmail.com>2017-09-17 23:31:15 -0400
committerEric Luehrsen <ericluehrsen@hotmail.com>2017-09-22 23:04:40 -0400
commit7ca169710e048f2e3a5d3a1ad3dbc96c666e03a7 (patch)
tree7ebc3ef99f72c3ed078ba563afceeee127ada4f6 /applications/luci-app-unbound/luasrc/model/cbi/unbound
parent678c15c0da5e9a133522dc66baafc088dcef5543 (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/model/cbi/unbound')
-rw-r--r--applications/luci-app-unbound/luasrc/model/cbi/unbound/configure.lua19
-rw-r--r--applications/luci-app-unbound/luasrc/model/cbi/unbound/extended.lua13
-rw-r--r--applications/luci-app-unbound/luasrc/model/cbi/unbound/manual.lua13
-rw-r--r--applications/luci-app-unbound/luasrc/model/cbi/unbound/server.lua13
4 files changed, 32 insertions, 26 deletions
diff --git a/applications/luci-app-unbound/luasrc/model/cbi/unbound/configure.lua b/applications/luci-app-unbound/luasrc/model/cbi/unbound/configure.lua
index 61dca765fa..cdf7757e3a 100644
--- a/applications/luci-app-unbound/luasrc/model/cbi/unbound/configure.lua
+++ b/applications/luci-app-unbound/luasrc/model/cbi/unbound/configure.lua
@@ -6,7 +6,7 @@
local m1, s1
local ena, mcf, lci, lsv, rlh, rpv, vld, nvd, eds, prt, tlm
local ctl, dlk, dom, dty, lfq, wfq, exa, dp6, d64, pfx, qry, qrs
-local pro, tgr, rsc, rsn, ag2
+local pro, tgr, rsc, rsn, ag2, stt
local ucl = luci.model.uci.cursor()
local valman = ucl:get_first("unbound", "unbound", "manual_conf")
@@ -34,8 +34,8 @@ mcf = s1:taboption("basic", Flag, "manual_conf", translate("Manual Conf:"),
translate("Skip UCI and use /etc/unbound/unbound.conf"))
mcf.rmempty = false
-lci = s1:taboption("basic", Flag, "luci_expanded", translate("LuCI Expanded:"),
- translate("See more detailed tabs for debug"))
+lci = s1:taboption("basic", Flag, "extended_luci", translate("Advanced LuCI:"),
+ translate("See detailed tabs for debug and advanced manual configuration"))
lci.rmempty = false
@@ -109,9 +109,14 @@ if valman ~= "1" then
tlm.rmempty = false
--Advanced Tab
- ctl = s1:taboption("advanced", Flag, "unbound_control", translate("Unbound Control App:"),
- translate("Enable unecrypted localhost access for unbound-control"))
+ ctl = s1:taboption("advanced", ListValue, "unbound_control", translate("Unbound Control App:"),
+ translate("Enable access for unbound-control"))
ctl.rmempty = false
+ ctl:value("0", translate("No Remote Control"))
+ ctl:value("1", translate("Local Host, No Encryption"))
+ ctl:value("2", translate("Local Host, Encrypted"))
+ ctl:value("3", translate("Local Subnet, Encrypted"))
+ ctl:value("4", translate("Local Subnet, Static Encryption"))
dlk = s1:taboption("advanced", ListValue, "dhcp_link", translate("DHCP Link:"),
translate("Link to supported programs to load DHCP into DNS"))
@@ -223,6 +228,10 @@ if valman ~= "1" then
ag2:value("24", "24")
ag2:value("99", "99 ("..translate("never")..")")
+ stt = s1:taboption("resource", Flag, "extended_stats", translate("Extended Statistics:"),
+ translate("Extended statistics are printed from unbound-control"))
+ stt.rmempty = false
+
tgr = s1:taboption("resource", Value, "trigger", translate("Trigger Networks:"),
translate("Networks that may trigger Unbound to reload (avoid wan6)"))
tgr.template = "cbi/network_netlist"
diff --git a/applications/luci-app-unbound/luasrc/model/cbi/unbound/extended.lua b/applications/luci-app-unbound/luasrc/model/cbi/unbound/extended.lua
index 0225712292..67d2ec6c6b 100644
--- a/applications/luci-app-unbound/luasrc/model/cbi/unbound/extended.lua
+++ b/applications/luci-app-unbound/luasrc/model/cbi/unbound/extended.lua
@@ -1,17 +1,16 @@
-- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
-- Licensed to the public under the Apache License 2.0.
-local filename = "/etc/unbound/unbound_ext.conf"
local m4, s4, frm
+local filename = "/etc/unbound/unbound_ext.conf"
+local description = translatef("Here you may edit 'forward:' and 'remote-control:' in an extended 'include:'")
+description = description .. " (" .. filename .. ")"
m4 = SimpleForm("editing", nil)
+m4:append(Template("unbound/css-editing"))
m4.submit = translate("Save")
m4.reset = false
-
-s4 = m4:section(SimpleSection, "Unbound Extended Conf",
- translatef("This allows you to edit %s which is copied to"
- .. " /var/ and 'include:' last for 'forward:' and other clauses", filename))
-
+s4 = m4:section(SimpleSection, "Unbound Extended Conf", description)
frm = s4:option(TextValue, "data")
frm.datatype = "string"
frm.rows = 20
@@ -23,7 +22,7 @@ end
function frm.write(self, section, data)
- return nixio.fs.writefile(filename, data)
+ return nixio.fs.writefile(filename, luci.util.trim(data:gsub("\r\n", "\n")))
end
diff --git a/applications/luci-app-unbound/luasrc/model/cbi/unbound/manual.lua b/applications/luci-app-unbound/luasrc/model/cbi/unbound/manual.lua
index 694180d5f2..5cfb9c32c1 100644
--- a/applications/luci-app-unbound/luasrc/model/cbi/unbound/manual.lua
+++ b/applications/luci-app-unbound/luasrc/model/cbi/unbound/manual.lua
@@ -1,17 +1,16 @@
-- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
-- Licensed to the public under the Apache License 2.0.
-local filename = "/etc/unbound/unbound.conf"
local m2, s2, frm
+local filename = "/etc/unbound/unbound.conf"
+local description = translatef("Here you may edit raw 'unbound.conf' when you don't use UCI:")
+description = description .. " (" .. filename .. ")"
m2 = SimpleForm("editing", nil)
+m2:append(Template("unbound/css-editing"))
m2.submit = translate("Save")
m2.reset = false
-
-s2 = m2:section(SimpleSection, "Unbound Conf",
- translatef("This allows you to edit raw %s which is copied to"
- .. " /var/ for Unbound's base conf when you don't use UCI", filename))
-
+s2 = m2:section(SimpleSection, "Unbound Conf", description)
frm = s2:option(TextValue, "data")
frm.datatype = "string"
frm.rows = 20
@@ -23,7 +22,7 @@ end
function frm.write(self, section, data)
- return nixio.fs.writefile(filename, data)
+ return nixio.fs.writefile(filename, luci.util.trim(data:gsub("\r\n", "\n")))
end
diff --git a/applications/luci-app-unbound/luasrc/model/cbi/unbound/server.lua b/applications/luci-app-unbound/luasrc/model/cbi/unbound/server.lua
index 1870462663..d0ac407847 100644
--- a/applications/luci-app-unbound/luasrc/model/cbi/unbound/server.lua
+++ b/applications/luci-app-unbound/luasrc/model/cbi/unbound/server.lua
@@ -1,17 +1,16 @@
-- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
-- Licensed to the public under the Apache License 2.0.
-local filename = "/etc/unbound/unbound_srv.conf"
local m3, s3, frm
+local filename = "/etc/unbound/unbound_srv.conf"
+local description = translatef("Here you may edit the 'server:' clause in an internal 'include:'")
+description = description .. " (" .. filename .. ")"
m3 = SimpleForm("editing", nil)
+m3:append(Template("unbound/css-editing"))
m3.submit = translate("Save")
m3.reset = false
-
-s3 = m3:section(SimpleSection, "Unbound Server Conf",
- translatef("This allows you to edit %s which is copied to"
- .. " /var/ and 'include:' within the 'server:' section.", filename))
-
+s3 = m3:section(SimpleSection, "Unbound Server Conf", description)
frm = s3:option(TextValue, "data")
frm.datatype = "string"
frm.rows = 20
@@ -23,7 +22,7 @@ end
function frm.write(self, section, data)
- return nixio.fs.writefile(filename, data)
+ return nixio.fs.writefile(filename, luci.util.trim(data:gsub("\r\n", "\n")))
end