2 LuCI - Lua Configuration Interface
4 Copyright 2014 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
15 local CTRL = require "luci.controller.ddns" -- this application's controller
16 local DISP = require "luci.dispatcher"
17 local SYS = require "luci.sys"
18 local DDNS = require "luci.tools.ddns" -- ddns multiused functions
20 -- check supported options -- ##################################################
21 -- saved to local vars here because doing multiple os calls slow down the system
22 has_ssl = DDNS.check_ssl() -- HTTPS support
23 has_proxy = DDNS.check_proxy() -- Proxy support
24 has_dnstcp = DDNS.check_bind_host() -- DNS TCP support
25 need_update = CTRL.update_needed() -- correct ddns-scripts version
28 font_red = [[<font color="red">]]
29 font_off = [[</font>]]
30 bold_on = [[<strong>]]
31 bold_off = [[</strong>]]
33 -- cbi-map definition -- #######################################################
36 -- first need to close <a> from cbi map template our <a> closed by template
37 m.title = [[</a><a href="]] .. DISP.build_url("admin", "services", "ddns") .. [[">]] ..
38 translate("Dynamic DNS")
40 m.description = translate("Dynamic DNS allows that your router can be reached with " ..
41 "a fixed hostname while having a dynamically changing " ..
44 m.redirect = DISP.build_url("admin", "services", "ddns")
46 -- SimpleSection definition -- #################################################
47 -- show Hints to optimize installation and script usage
48 s = m:section( SimpleSection,
50 translate("Below a list of configuration tips for your system to run Dynamic DNS updates without limitations") )
52 -- ddns_scripts needs to be updated for full functionality
54 local dv = s:option(DummyValue, "_update_needed")
55 dv.titleref = DISP.build_url("admin", "system", "packages")
57 dv.title = font_red .. bold_on ..
58 translate("Software update required") .. bold_off .. font_off
59 dv.value = translate("The currently installed 'ddns-scripts' package did not support all available settings.") ..
61 translate("Please update to the current version!")
64 -- DDNS Service disabled
65 if not SYS.init.enabled("ddns") then
66 local dv = s:option(DummyValue, "_not_enabled")
67 dv.titleref = DISP.build_url("admin", "system", "startup")
70 translate("DDNS Autostart disabled") .. bold_off
71 dv.value = translate("Currently DDNS updates are not started at boot or on interface events." .. "<br />" ..
72 "This is the default if you run DDNS scripts by yourself (i.e. via cron with force_interval set to '0')" )
76 if not DDNS.check_ipv6() then
77 local dv = s:option(DummyValue, "_no_ipv6")
78 dv.titleref = 'http://www.openwrt.org" target="_blank'
81 translate("IPv6 not supported") .. bold_off
82 dv.value = translate("IPv6 is currently not (fully) supported by this system" .. "<br />" ..
83 "Please follow the instructions on OpenWrt's homepage to enable IPv6 support" .. "<br />" ..
84 "or update your system to the latest OpenWrt Release")
89 local dv = s:option(DummyValue, "_no_https")
90 dv.titleref = DISP.build_url("admin", "system", "packages")
93 translate("HTTPS not supported") .. bold_off
94 dv.value = translate("Neither GNU Wget with SSL nor cURL installed to support updates via HTTPS protocol.") ..
96 translate("You should install GNU Wget with SSL (prefered) or cURL package.") ..
98 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
101 -- cURL without proxy support
102 if has_ssl and not has_proxy then
103 local dv = s:option(DummyValue, "_no_proxy")
104 dv.titleref = DISP.build_url("admin", "system", "packages")
106 dv.title = bold_on ..
107 translate("cURL without Proxy Support") .. bold_off
108 dv.value = translate("cURL is installed, but libcurl was compiled without proxy support.") ..
110 translate("You should install GNU Wget with SSL or replace libcurl.") ..
112 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
115 -- "Force IP Version not supported"
116 if not (has_ssl and has_dnstcp) then
117 local dv = s:option(DummyValue, "_no_force_ip")
118 dv.titleref = DISP.build_url("admin", "system", "packages")
120 dv.title = bold_on ..
121 translate("Force IP Version not supported") .. bold_off
122 local value = translate("BusyBox's nslookup and Wget do not support to specify " ..
123 "the IP version to use for communication with DDNS Provider.")
125 value = value .. "<br />- " ..
126 translate("You should install GNU Wget with SSL (prefered) or cURL package.")
128 if not has_dnstcp then
129 value = value .. "<br />- " ..
130 translate("You should install BIND host package for DNS requests.")
135 -- "DNS requests via TCP not supported"
136 if not has_dnstcp then
137 local dv = s:option(DummyValue, "_no_dnstcp")
138 dv.titleref = DISP.build_url("admin", "system", "packages")
140 dv.title = bold_on ..
141 translate("DNS requests via TCP not supported") .. bold_off
142 dv.value = translate("BusyBox's nslookup does not support to specify to use TCP instead of default UDP when requesting DNS server") ..
144 translate("You should install BIND host package for DNS requests.")