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>
This commit is contained in:
parent
2d352a9251
commit
09c3a8385e
2 changed files with 8 additions and 6 deletions
|
@ -16,10 +16,11 @@ PKG_VERSION:=2.4.9
|
||||||
|
|
||||||
# Release == build
|
# Release == build
|
||||||
# increase on changes of translation files
|
# increase on changes of translation files
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
|
|
||||||
PKG_LICENSE:=Apache-2.0
|
PKG_LICENSE:=Apache-2.0
|
||||||
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
|
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>, \
|
||||||
|
Ansuel Smith <ansuelsmth@gmail.com>
|
||||||
|
|
||||||
# LuCI specific settings
|
# LuCI specific settings
|
||||||
LUCI_TITLE:=LuCI Support for Dynamic DNS Client (ddns-scripts)
|
LUCI_TITLE:=LuCI Support for Dynamic DNS Client (ddns-scripts)
|
||||||
|
|
|
@ -172,7 +172,7 @@ local function _option_used(option, urlscript)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function to verify if option is valid
|
-- 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)
|
-- section is globally defined here be calling agrument (see above)
|
||||||
local fusev6 = usev6:formvalue(section) or "0"
|
local fusev6 = usev6:formvalue(section) or "0"
|
||||||
local fsvc4 = svc4:formvalue(section) or "-"
|
local fsvc4 = svc4:formvalue(section) or "-"
|
||||||
|
@ -204,6 +204,7 @@ local function _option_validate(self, value)
|
||||||
if used < 1 then return "" end
|
if used < 1 then return "" end
|
||||||
-- needed but no data then return error
|
-- needed but no data then return error
|
||||||
if not value or (#value == 0) then
|
if not value or (#value == 0) then
|
||||||
|
if optional then return nil end
|
||||||
return nil, err_tab_basic(self) .. translate("missing / required")
|
return nil, err_tab_basic(self) .. translate("missing / required")
|
||||||
end
|
end
|
||||||
return value
|
return value
|
||||||
|
@ -513,18 +514,18 @@ pe = ns:taboption("basic", Value, "param_enc",
|
||||||
translate("Optional Encoded Parameter"),
|
translate("Optional Encoded Parameter"),
|
||||||
translate("Optional: Replaces [PARAMENC] in Update-URL (URL-encoded)") )
|
translate("Optional: Replaces [PARAMENC] in Update-URL (URL-encoded)") )
|
||||||
function pe.validate(self, value)
|
function pe.validate(self, value)
|
||||||
return _option_validate(self, value)
|
return _option_validate(self, value, true)
|
||||||
end
|
end
|
||||||
function pe.parse(self, section, novld)
|
function pe.parse(self, section, novld)
|
||||||
DDNS.value_parse(self, section, novld)
|
DDNS.value_parse(self, section, novld)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- IPv4/IPv6 - param_enc -- ###################################################
|
-- IPv4/IPv6 - param_opt -- ###################################################
|
||||||
po = ns:taboption("basic", Value, "param_opt",
|
po = ns:taboption("basic", Value, "param_opt",
|
||||||
translate("Optional Parameter"),
|
translate("Optional Parameter"),
|
||||||
translate("Optional: Replaces [PARAMOPT] in Update-URL (NOT URL-encoded)") )
|
translate("Optional: Replaces [PARAMOPT] in Update-URL (NOT URL-encoded)") )
|
||||||
function po.validate(self, value)
|
function po.validate(self, value)
|
||||||
return _option_validate(self, value)
|
return _option_validate(self, value, true)
|
||||||
end
|
end
|
||||||
function po.parse(self, section, novld)
|
function po.parse(self, section, novld)
|
||||||
DDNS.value_parse(self, section, novld)
|
DDNS.value_parse(self, section, novld)
|
||||||
|
|
Loading…
Reference in a new issue