1 -- Copyright 2014-2016 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
2 -- Licensed to the public under the Apache License 2.0.
4 local DISP = require "luci.dispatcher"
5 local SYS = require "luci.sys"
6 local CTRL = require "luci.controller.ddns" -- this application's controller
7 local DDNS = require "luci.tools.ddns" -- ddns multiused functions
10 font_red = [[<font color="red">]]
11 font_off = [[</font>]]
12 bold_on = [[<strong>]]
13 bold_off = [[</strong>]]
15 -- cbi-map definition -- #######################################################
17 m.title = CTRL.app_title_back()
18 m.description = CTRL.app_description()
19 m.redirect = DISP.build_url("admin", "services", "ddns")
21 -- SimpleSection definition -- #################################################
22 -- show Hints to optimize installation and script usage
23 s = m:section( SimpleSection,
25 translate("Below a list of configuration tips for your system to run Dynamic DNS updates without limitations") )
27 -- ddns-scripts needs to be updated for full functionality
28 if not CTRL.service_ok() then
29 local so = s:option(DummyValue, "_update_needed")
30 so.titleref = DISP.build_url("admin", "system", "packages")
32 so.title = font_red .. bold_on ..
33 translate("Software update required") .. bold_off .. font_off
34 so.value = translate("The currently installed 'ddns-scripts' package did not support all available settings.") ..
36 translate("Please update to the current version!")
39 -- DDNS Service disabled
40 if not SYS.init.enabled("ddns") then
41 local se = s:option(DummyValue, "_not_enabled")
42 se.titleref = DISP.build_url("admin", "system", "startup")
45 translate("DDNS Autostart disabled") .. bold_off
46 se.value = translate("Currently DDNS updates are not started at boot or on interface events." .. "<br />" ..
47 "This is the default if you run DDNS scripts by yourself (i.e. via cron with force_interval set to '0')" )
51 if not DDNS.has_ipv6 then
52 local v6 = s:option(DummyValue, "_no_ipv6")
53 v6.titleref = 'http://www.openwrt.org" target="_blank'
56 translate("IPv6 not supported") .. bold_off
57 v6.value = translate("IPv6 is currently not (fully) supported by this system" .. "<br />" ..
58 "Please follow the instructions on OpenWrt's homepage to enable IPv6 support" .. "<br />" ..
59 "or update your system to the latest OpenWrt Release")
63 if not DDNS.has_ssl then
64 local sl = s:option(DummyValue, "_no_https")
65 sl.titleref = DISP.build_url("admin", "system", "packages")
68 translate("HTTPS not supported") .. bold_off
69 sl.value = translate("Neither GNU Wget with SSL nor cURL installed to support secure updates via HTTPS protocol.") ..
71 translate("You should install 'wget' or 'curl' or 'uclient-fetch' with 'libustream-*ssl' package.") ..
73 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
77 if not DDNS.has_bindnet then
78 local bn = s:option(DummyValue, "_no_bind_network")
79 bn.titleref = DISP.build_url("admin", "system", "packages")
82 translate("Binding to a specific network not supported") .. bold_off
83 bn.value = translate("Neither GNU Wget with SSL nor cURL installed to select a network to use for communication.") ..
85 translate("You should install 'wget' or 'curl' package.") ..
87 translate("GNU Wget will use the IP of given network, cURL will use the physical interface.") ..
89 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
92 -- currently only cURL possibly without proxy support
93 if not DDNS.has_proxy then
94 local px = s:option(DummyValue, "_no_proxy")
95 px.titleref = DISP.build_url("admin", "system", "packages")
98 translate("cURL without Proxy Support") .. bold_off
99 px.value = translate("cURL is installed, but libcurl was compiled without proxy support.") ..
101 translate("You should install 'wget' or 'uclient-fetch' package or replace libcurl.") ..
103 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
106 -- "Force IP Version not supported"
107 if not DDNS.has_forceip then
108 local fi = s:option(DummyValue, "_no_force_ip")
109 fi.titleref = DISP.build_url("admin", "system", "packages")
111 fi.title = bold_on ..
112 translate("Force IP Version not supported") .. bold_off
113 local value = translate("BusyBox's nslookup and Wget do not support to specify " ..
114 "the IP version to use for communication with DDNS Provider!")
115 if not (DDNS.has_wgetssl or DDNS.has_curl or DDNS.has_fetch) then
116 value = value .. "<br />- " ..
117 translate("You should install 'wget' or 'curl' or 'uclient-fetch' package.")
119 if not DDNS.has_bindhost then
120 value = value .. "<br />- " ..
121 translate("You should install 'bind-host' or 'knot-host' or 'drill' package for DNS requests.")
126 -- "DNS requests via TCP not supported"
127 if not DDNS.has_bindhost then
128 local dt = s:option(DummyValue, "_no_dnstcp")
129 dt.titleref = DISP.build_url("admin", "system", "packages")
131 dt.title = bold_on ..
132 translate("DNS requests via TCP not supported") .. bold_off
133 dt.value = translate("BusyBox's nslookup and hostip do not support to specify to use TCP " ..
134 "instead of default UDP when requesting DNS server!") ..
136 translate("You should install 'bind-host' or 'knot-host' or 'drill' package for DNS requests.")
139 -- nslookup compiled with musl produce problems when using
140 if not DDNS.has_dnsserver then
141 local ds = s:option(DummyValue, "_no_dnsserver")
142 ds.titleref = DISP.build_url("admin", "system", "packages")
144 ds.title = bold_on ..
145 translate("Using specific DNS Server not supported") .. bold_off
146 ds.value = translate("BusyBox's nslookup in the current compiled version " ..
147 "does not handle given DNS Servers correctly!") ..
149 translate("You should install 'bind-host' or 'knot-host' or 'drill' or 'hostip' package, " ..
150 "if you need to specify a DNS server to detect your registered IP.")
153 -- certificates installed
154 if DDNS.has_ssl and not DDNS.has_cacerts then
155 local ca = s:option(DummyValue, "_no_certs")
156 ca.titleref = DISP.build_url("admin", "system", "packages")
158 ca.title = bold_on ..
159 translate("No certificates found") .. bold_off
160 ca.value = translate("If using secure communication you should verify server certificates!") ..
162 translate("Install 'ca-certificates' package or needed certificates " ..
163 "by hand into /etc/ssl/certs default directory")