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")
19 m = Map("ddns", translate("Dynamic DNS"), translate("Dynamic DNS allows that your router can be reached with a fixed hostname while having a dynamically changing IP-Address."))
21 s = m:section(TypedSection, "service", "")
25 s:option(Flag, "enabled", translate("enable"))
27 svc = s:option(Value, "service_name", translate("Service"))
31 local fd = io.open("/usr/lib/ddns/services", "r")
36 local s = ln and ln:match('^%s*"([^"]+)"')
37 if s then services[#services+1] = s end
43 for _, v in luci.util.vspairs(services) do
48 s:option(Value, "domain", translate("Hostname")).rmempty = true
49 s:option(Value, "username", translate("Username")).rmempty = true
50 pw = s:option(Value, "password", translate("Password"))
56 s.defaults.ip_source = "network"
57 s.defaults.ip_network = "wan"
59 require("luci.tools.webadmin")
61 src = s:option(ListValue, "ip_source", translate("Source of IP-Address"))
62 src:value("network", translate("Network"))
63 src:value("interface", translate("Interface"))
64 src:value("web", "URL")
66 iface = s:option(ListValue, "ip_network", translate("Network"))
67 iface:depends("ip_source", "network")
69 luci.tools.webadmin.cbi_add_networks(iface)
71 iface = s:option(ListValue, "ip_interface", translate("Interface"))
72 iface:depends("ip_source", "interface")
74 for k, v in pairs(luci.sys.net.devices()) do
78 web = s:option(Value, "ip_url", "URL")
79 web:depends("ip_source", "web")
82 s:option(Value, "update_url", translate("Custom Update-URL")).optional = true
86 s:option(Value, "check_interval", translate("Check for changed IP every")).default = 10
87 unit = s:option(ListValue, "check_unit", translate("Check-Time unit"))
88 unit.default = "minutes"
89 unit:value("minutes", "min")
90 unit:value("hours", "h")
92 s:option(Value, "force_interval", translate("Force update every")).default = 72
93 unit = s:option(ListValue, "force_unit", translate("Force-Time unit"))
94 unit.default = "hours"
95 unit:value("minutes", "min")
96 unit:value("hours", "h")