applications/luci-ddns: fix selection of custom update_url
This commit is contained in:
parent
143131ea77
commit
e55f2e12a8
1 changed files with 20 additions and 3 deletions
|
@ -28,7 +28,7 @@ s.anonymous = false
|
||||||
s:option(Flag, "enabled", translate("Enable"))
|
s:option(Flag, "enabled", translate("Enable"))
|
||||||
|
|
||||||
svc = s:option(ListValue, "service_name", translate("Service"))
|
svc = s:option(ListValue, "service_name", translate("Service"))
|
||||||
svc.rmempty = true
|
svc.rmempty = false
|
||||||
|
|
||||||
local services = { }
|
local services = { }
|
||||||
local fd = io.open("/usr/lib/ddns/services", "r")
|
local fd = io.open("/usr/lib/ddns/services", "r")
|
||||||
|
@ -47,10 +47,27 @@ for _, v in luci.util.vspairs(services) do
|
||||||
svc:value(v)
|
svc:value(v)
|
||||||
end
|
end
|
||||||
|
|
||||||
svc:value("", "-- "..translate("custom").." --")
|
function svc.cfgvalue(...)
|
||||||
|
local v = Value.cfgvalue(...)
|
||||||
|
if not v or #v == 0 then
|
||||||
|
return "-"
|
||||||
|
else
|
||||||
|
return v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function svc.write(self, section, value)
|
||||||
|
if value == "-" then
|
||||||
|
m.uci:delete("ddns", section, self.option)
|
||||||
|
else
|
||||||
|
Value.write(self, section, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
svc:value("-", "-- "..translate("custom").." --")
|
||||||
|
|
||||||
url = s:option(Value, "update_url", translate("Custom update-URL"))
|
url = s:option(Value, "update_url", translate("Custom update-URL"))
|
||||||
url:depends("service_name", "")
|
url:depends("service_name", "-")
|
||||||
url.rmempty = true
|
url.rmempty = true
|
||||||
|
|
||||||
s:option(Value, "domain", translate("Hostname")).rmempty = true
|
s:option(Value, "domain", translate("Hostname")).rmempty = true
|
||||||
|
|
Loading…
Reference in a new issue