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").." --")
49 url = s:option(Value, "update_url", translate("Custom update-URL"))
50 url:depends("service_name", "")
53 s:option(Value, "domain", translate("Hostname")).rmempty = true
54 s:option(Value, "username", translate("Username")).rmempty = true
55 pw = s:option(Value, "password", translate("Password"))
61 s.defaults.ip_source = "network"
62 s.defaults.ip_network = "wan"
64 require("luci.tools.webadmin")
66 src = s:option(ListValue, "ip_source", translate("Source of IP-Address"))
67 src:value("network", translate("Network"))
68 src:value("interface", translate("Interface"))
69 src:value("web", "URL")
71 iface = s:option(ListValue, "ip_network", translate("Network"))
72 iface:depends("ip_source", "network")
74 luci.tools.webadmin.cbi_add_networks(iface)
76 iface = s:option(ListValue, "ip_interface", translate("Interface"))
77 iface:depends("ip_source", "interface")
79 for k, v in pairs(luci.sys.net.devices()) do
83 web = s:option(Value, "ip_url", "URL")
84 web:depends("ip_source", "web")
88 s:option(Value, "check_interval", translate("Check for changed IP every")).default = 10
89 unit = s:option(ListValue, "check_unit", translate("Check-Time unit"))
90 unit.default = "minutes"
91 unit:value("minutes", "min")
92 unit:value("hours", "h")
94 s:option(Value, "force_interval", translate("Force update every")).default = 72
95 unit = s:option(ListValue, "force_unit", translate("Force-Time unit"))
96 unit.default = "hours"
97 unit:value("minutes", "min")
98 unit:value("hours", "h")