2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
16 local is_mini = (luci.dispatcher.context.path[1] == "mini")
18 m = Map("ddns", translate("ddns"), translate("ddns_desc"))
20 s = m:section(TypedSection, "service", "")
24 s:option(Flag, "enabled", translate("enable"))
26 svc = s:option(Value, "service_name", translate("service"))
30 local fd = io.open("/usr/lib/ddns/services", "r")
35 local s = ln and ln:match('^%s*"([^"]+)"')
36 if s then services[#services+1] = s end
42 for _, v in luci.util.vspairs(services) do
47 s:option(Value, "domain", translate("hostname")).rmempty = true
48 s:option(Value, "username", translate("username")).rmempty = true
49 pw = s:option(Value, "password", translate("password"))
55 s.defaults.ip_source = "network"
56 s.defaults.ip_network = "wan"
58 require("luci.tools.webadmin")
60 src = s:option(ListValue, "ip_source")
61 src:value("network", translate("network"))
62 src:value("interface", translate("interface"))
63 src:value("web", "URL")
65 iface = s:option(ListValue, "ip_network", translate("network"))
66 iface:depends("ip_source", "network")
68 luci.tools.webadmin.cbi_add_networks(iface)
70 iface = s:option(ListValue, "ip_interface", translate("interface"))
71 iface:depends("ip_source", "interface")
73 for k, v in pairs(luci.sys.net.devices()) do
77 web = s:option(Value, "ip_url", "URL")
78 web:depends("ip_source", "web")
81 s:option(Value, "update_url").optional = true
85 s:option(Value, "check_interval").default = 10
86 unit = s:option(ListValue, "check_unit")
87 unit.default = "minutes"
88 unit:value("minutes", "min")
89 unit:value("hours", "h")
91 s:option(Value, "force_interval").default = 72
92 unit = s:option(ListValue, "force_unit")
93 unit.default = "hours"
94 unit:value("minutes", "min")
95 unit:value("hours", "h")