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"),
20 translate("Dynamic DNS allows that your router can be reached with " ..
21 "a fixed hostname while having a dynamically changing " ..
24 s = m:section(TypedSection, "service", "")
28 s:option(Flag, "enabled", translate("Enable"))
30 svc = s:option(ListValue, "service_name", translate("Service"))
34 local fd = io.open("/usr/lib/ddns/services", "r")
39 local s = ln and ln:match('^%s*"([^"]+)"')
40 if s then services[#services+1] = s end
46 for _, v in luci.util.vspairs(services) do
50 svc:value("", "-- "..translate("custom").." --")
52 url = s:option(Value, "update_url", translate("Custom update-URL"))
53 url:depends("service_name", "")
56 s:option(Value, "domain", translate("Hostname")).rmempty = true
57 s:option(Value, "username", translate("Username")).rmempty = true
58 pw = s:option(Value, "password", translate("Password"))
64 s.defaults.ip_source = "network"
65 s.defaults.ip_network = "wan"
67 require("luci.tools.webadmin")
69 src = s:option(ListValue, "ip_source",
70 translate("Source of IP address"))
71 src:value("network", translate("network"))
72 src:value("interface", translate("interface"))
73 src:value("web", translate("URL"))
75 iface = s:option(ListValue, "ip_network", translate("Network"))
76 iface:depends("ip_source", "network")
78 luci.tools.webadmin.cbi_add_networks(iface)
80 iface = s:option(ListValue, "ip_interface", translate("Interface"))
81 iface:depends("ip_source", "interface")
83 for k, v in pairs(luci.sys.net.devices()) do
87 web = s:option(Value, "ip_url", translate("URL"))
88 web:depends("ip_source", "web")
93 s:option(Value, "check_interval",
94 translate("Check for changed IP every")).default = 10
95 unit = s:option(ListValue, "check_unit", translate("Check-time unit"))
96 unit.default = "minutes"
97 unit:value("minutes", translate("min"))
98 unit:value("hours", translate("h"))
100 s:option(Value, "force_interval", translate("Force update every")).default = 72
101 unit = s:option(ListValue, "force_unit", translate("Force-time unit"))
102 unit.default = "hours"
103 unit:value("minutes", translate("min"))
104 unit:value("hours", translate("h"))