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(ListValue, "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
47 svc:value("", translate("-- custom --"))
50 s:option(Value, "domain", translate("Hostname")).rmempty = true
51 s:option(Value, "username", translate("Username")).rmempty = true
52 pw = s:option(Value, "password", translate("Password"))
58 s.defaults.ip_source = "network"
59 s.defaults.ip_network = "wan"
61 require("luci.tools.webadmin")
63 src = s:option(ListValue, "ip_source", translate("Source of IP-Address"))
64 src:value("network", translate("Network"))
65 src:value("interface", translate("Interface"))
66 src:value("web", "URL")
68 iface = s:option(ListValue, "ip_network", translate("Network"))
69 iface:depends("ip_source", "network")
71 luci.tools.webadmin.cbi_add_networks(iface)
73 iface = s:option(ListValue, "ip_interface", translate("Interface"))
74 iface:depends("ip_source", "interface")
76 for k, v in pairs(luci.sys.net.devices()) do
80 web = s:option(Value, "ip_url", "URL")
81 web:depends("ip_source", "web")
85 url = s:option(Value, "update_url", translate("Custom Update-URL"))
86 url:depends("service_name", "")
89 s:option(Value, "check_interval", translate("Check for changed IP every")).default = 10
90 unit = s:option(ListValue, "check_unit", translate("Check-Time unit"))
91 unit.default = "minutes"
92 unit:value("minutes", "min")
93 unit:value("hours", "h")
95 s:option(Value, "force_interval", translate("Force update every")).default = 72
96 unit = s:option(ListValue, "force_unit", translate("Force-Time unit"))
97 unit.default = "hours"
98 unit:value("minutes", "min")
99 unit:value("hours", "h")