From c481f3f34325b9c1cf817b16a567a6b10fdd1f2e Mon Sep 17 00:00:00 2001 From: Daniel Dickinson Date: Mon, 14 Dec 2015 22:51:29 -0500 Subject: validation: Add option ipv4only option to host and hostport datatypes Some applications only support ipv4 so add ipv4only option to host and hostport datatypes so that for thos applications that when an IP address is specified only and ipv4 ip address gets accepted. --- .../luci-app-pbx-voicemail/luasrc/model/cbi/pbx-voicemail.lua | 2 +- applications/luci-app-pbx/luasrc/model/cbi/pbx-advanced.lua | 2 +- applications/luci-app-pbx/luasrc/model/cbi/pbx-voip.lua | 6 +++--- .../luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua | 2 +- applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua | 3 ++- .../luci-app-watchcat/luasrc/model/cbi/watchcat/watchcat.lua | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) (limited to 'applications') diff --git a/applications/luci-app-pbx-voicemail/luasrc/model/cbi/pbx-voicemail.lua b/applications/luci-app-pbx-voicemail/luasrc/model/cbi/pbx-voicemail.lua index 9ff2ed97f..a6087e9ae 100644 --- a/applications/luci-app-pbx-voicemail/luasrc/model/cbi/pbx-voicemail.lua +++ b/applications/luci-app-pbx-voicemail/luasrc/model/cbi/pbx-voicemail.lua @@ -92,7 +92,7 @@ s = m:section(NamedSection, "voicemail_smtp", "voicemail", translate("Outgoing m s.anonymous = true serv = s:option(Value, "smtp_server", translate("SMTP Server Hostname or IP Address")) -serv.datatype = "host" +serv.datatype = "host(0)" port = s:option(Value, "smtp_port", translate("SMTP Port Number")) port.datatype = "port" diff --git a/applications/luci-app-pbx/luasrc/model/cbi/pbx-advanced.lua b/applications/luci-app-pbx/luasrc/model/cbi/pbx-advanced.lua index 5d4f135c5..34288c663 100644 --- a/applications/luci-app-pbx/luasrc/model/cbi/pbx-advanced.lua +++ b/applications/luci-app-pbx/luasrc/model/cbi/pbx-advanced.lua @@ -264,7 +264,7 @@ h = s:taboption("remote_usage", Value, "externhost", translate("Domain/IP Addres The best thing to input is a static IP address. If your IP address is dynamic and it changes, \ your configuration will become invalid. Hence, it's recommended to set up Dynamic DNS in this case. \ and enter your Dynamic DNS hostname here. You can configure Dynamic DNS with the luci-app-ddns package.")) -h.datatype = "host" +h.datatype = "host(0)" p = s:taboption("remote_usage", Value, "bindport", translate("External SIP Port"), translate("Pick a random port number between 6500 and 9500 for the service to listen on. \ diff --git a/applications/luci-app-pbx/luasrc/model/cbi/pbx-voip.lua b/applications/luci-app-pbx/luasrc/model/cbi/pbx-voip.lua index ed1ed1edb..9b4620285 100644 --- a/applications/luci-app-pbx/luasrc/model/cbi/pbx-voip.lua +++ b/applications/luci-app-pbx/luasrc/model/cbi/pbx-voip.lua @@ -84,7 +84,7 @@ function pwd.write(self, section, value) end h = s:option(Value, "host", translate("SIP Server/Registrar")) -h.datatype = "host" +h.datatype = "host(0)" p = s:option(ListValue, "register", translate("Enable Incoming Calls (Register via SIP)"), translate("This option should be set to \"Yes\" if you have a DID \(real telephone number\) \ @@ -103,7 +103,7 @@ p.default = "yes" from = s:option(Value, "fromdomain", translate("SIP Realm (needed by some providers)")) from.optional = true -from.datatype = "host" +from.datatype = "host(0)" port = s:option(Value, "port", translate("SIP Server/Registrar Port")) port.optional = true @@ -111,6 +111,6 @@ port.datatype = "port" op = s:option(Value, "outboundproxy", translate("Outbound Proxy")) op.optional = true -op.datatype = "host" +op.datatype = "host(0)" return m diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua index 59266e553..950d7a797 100644 --- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/olsrd.lua @@ -12,7 +12,7 @@ enable.default = 0 host = s:option(Value, "Host", translate("Host"), translate("IP or hostname where to get the txtinfo output from")) host.placeholder = "127.0.0.1" -host.datatype = "host" +host.datatype = "host(1)" host.rmempty = true port = s:option(Value, "Port", translate("Port")) diff --git a/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua b/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua index 19bdd9afc..11f34fbad 100644 --- a/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua +++ b/applications/luci-app-tinyproxy/luasrc/model/cbi/tinyproxy.lua @@ -227,7 +227,7 @@ ta = s:option(Value, "target", translate("Target host"), ta.rmempty = true ta.placeholder = "0.0.0.0/0" -ta.datatype = "host" +ta.datatype = "host(1)" v = s:option(Value, "via", translate("Via proxy"), @@ -235,5 +235,6 @@ v = s:option(Value, "via", translate("Via proxy"), v:depends({type="proxy"}) v.placeholder = "10.0.0.1:8080" +v.datatype = "ip4addrport" return m diff --git a/applications/luci-app-watchcat/luasrc/model/cbi/watchcat/watchcat.lua b/applications/luci-app-watchcat/luasrc/model/cbi/watchcat/watchcat.lua index 883416b21..f64370bfe 100644 --- a/applications/luci-app-watchcat/luasrc/model/cbi/watchcat/watchcat.lua +++ b/applications/luci-app-watchcat/luasrc/model/cbi/watchcat/watchcat.lua @@ -38,7 +38,7 @@ period = s:option(Value, "period", pinghost = s:option(Value, "pinghosts", translate("Ping host"), translate("Host address to ping")) -pinghost.datatype = "host" +pinghost.datatype = "host(1)" pinghost.default = "8.8.8.8" pinghost:depends({mode="ping"}) -- cgit v1.2.3