summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns/luasrc
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2018-05-27 19:51:38 +0200
committerAnsuel Smith <ansuelsmth@gmail.com>2018-06-04 09:37:05 +0200
commit09c3a8385e2176fc8a4f934e592f4089b662a1c1 (patch)
tree07e00b119446fc5e2eadf559efb4ef6a66665111 /applications/luci-app-ddns/luasrc
parent2d352a9251f99628162ac6bccf13c0fd5d9a71f8 (diff)
luci-app-ddns: make param opt, optional, add myself as maintainer
Currently these params should be optional but in the current script then are required for any configuration to save. We add an "optional" boolean value to the validate function so that we can make this pram optional as it should be. Also adds me as maintainer Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'applications/luci-app-ddns/luasrc')
-rw-r--r--applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua b/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua
index 10d39c7183..eb2159076e 100644
--- a/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua
+++ b/applications/luci-app-ddns/luasrc/model/cbi/ddns/detail.lua
@@ -172,7 +172,7 @@ local function _option_used(option, urlscript)
end
-- function to verify if option is valid
-local function _option_validate(self, value)
+local function _option_validate(self, value, optional)
-- section is globally defined here be calling agrument (see above)
local fusev6 = usev6:formvalue(section) or "0"
local fsvc4 = svc4:formvalue(section) or "-"
@@ -204,6 +204,7 @@ local function _option_validate(self, value)
if used < 1 then return "" end
-- needed but no data then return error
if not value or (#value == 0) then
+ if optional then return nil end
return nil, err_tab_basic(self) .. translate("missing / required")
end
return value
@@ -513,18 +514,18 @@ pe = ns:taboption("basic", Value, "param_enc",
translate("Optional Encoded Parameter"),
translate("Optional: Replaces [PARAMENC] in Update-URL (URL-encoded)") )
function pe.validate(self, value)
- return _option_validate(self, value)
+ return _option_validate(self, value, true)
end
function pe.parse(self, section, novld)
DDNS.value_parse(self, section, novld)
end
--- IPv4/IPv6 - param_enc -- ###################################################
+-- IPv4/IPv6 - param_opt -- ###################################################
po = ns:taboption("basic", Value, "param_opt",
translate("Optional Parameter"),
translate("Optional: Replaces [PARAMOPT] in Update-URL (NOT URL-encoded)") )
function po.validate(self, value)
- return _option_validate(self, value)
+ return _option_validate(self, value, true)
end
function po.parse(self, section, novld)
DDNS.value_parse(self, section, novld)