1 -- Copyright 2014 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
9 -- check supported options -- ##################################################
10 -- saved to local vars here because doing multiple os calls slow down the system
11 has_ssl = DDNS.check_ssl() -- HTTPS support and --bind-network / --interface
12 has_proxy = DDNS.check_proxy() -- Proxy support
13 has_dnstcp = DDNS.check_bind_host() -- DNS TCP support
16 font_red = [[<font color="red">]]
17 font_off = [[</font>]]
18 bold_on = [[<strong>]]
19 bold_off = [[</strong>]]
21 -- cbi-map definition -- #######################################################
23 m.title = CTRL.app_title_back()
24 m.description = CTRL.app_description()
25 m.redirect = DISP.build_url("admin", "services", "ddns")
27 -- SimpleSection definition -- #################################################
28 -- show Hints to optimize installation and script usage
29 s = m:section( SimpleSection,
31 translate("Below a list of configuration tips for your system to run Dynamic DNS updates without limitations") )
33 -- ddns_scripts needs to be updated for full functionality
34 if not CTRL.service_ok() then
35 local dv = s:option(DummyValue, "_update_needed")
36 dv.titleref = DISP.build_url("admin", "system", "packages")
38 dv.title = font_red .. bold_on ..
39 translate("Software update required") .. bold_off .. font_off
40 dv.value = translate("The currently installed 'ddns-scripts' package did not support all available settings.") ..
42 translate("Please update to the current version!")
45 -- DDNS Service disabled
46 if not SYS.init.enabled("ddns") then
47 local dv = s:option(DummyValue, "_not_enabled")
48 dv.titleref = DISP.build_url("admin", "system", "startup")
51 translate("DDNS Autostart disabled") .. bold_off
52 dv.value = translate("Currently DDNS updates are not started at boot or on interface events." .. "<br />" ..
53 "This is the default if you run DDNS scripts by yourself (i.e. via cron with force_interval set to '0')" )
57 if not DDNS.check_ipv6() then
58 local dv = s:option(DummyValue, "_no_ipv6")
59 dv.titleref = 'http://www.openwrt.org" target="_blank'
62 translate("IPv6 not supported") .. bold_off
63 dv.value = translate("IPv6 is currently not (fully) supported by this system" .. "<br />" ..
64 "Please follow the instructions on OpenWrt's homepage to enable IPv6 support" .. "<br />" ..
65 "or update your system to the latest OpenWrt Release")
70 local dv = s:option(DummyValue, "_no_https")
71 dv.titleref = DISP.build_url("admin", "system", "packages")
74 translate("HTTPS not supported") .. bold_off
75 dv.value = translate("Neither GNU Wget with SSL nor cURL installed to support updates via HTTPS protocol.") ..
77 translate("You should install GNU Wget with SSL (prefered) or cURL package.") ..
79 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
84 local dv = s:option(DummyValue, "_no_bind_network")
85 dv.titleref = DISP.build_url("admin", "system", "packages")
88 translate("Binding to a specific network not supported") .. bold_off
89 dv.value = translate("Neither GNU Wget with SSL nor cURL installed to select a network to use for communication.") ..
91 translate("You should install GNU Wget with SSL or cURL package.") ..
93 translate("GNU Wget will use the IP of given network, cURL will use the physical interface.") ..
95 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
98 -- cURL without proxy support
99 if has_ssl and not has_proxy then
100 local dv = s:option(DummyValue, "_no_proxy")
101 dv.titleref = DISP.build_url("admin", "system", "packages")
103 dv.title = bold_on ..
104 translate("cURL without Proxy Support") .. bold_off
105 dv.value = translate("cURL is installed, but libcurl was compiled without proxy support.") ..
107 translate("You should install GNU Wget with SSL or replace libcurl.") ..
109 translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
112 -- "Force IP Version not supported"
113 if not (has_ssl and has_dnstcp) then
114 local dv = s:option(DummyValue, "_no_force_ip")
115 dv.titleref = DISP.build_url("admin", "system", "packages")
117 dv.title = bold_on ..
118 translate("Force IP Version not supported") .. bold_off
119 local value = translate("BusyBox's nslookup and Wget do not support to specify " ..
120 "the IP version to use for communication with DDNS Provider.")
122 value = value .. "<br />- " ..
123 translate("You should install GNU Wget with SSL (prefered) or cURL package.")
125 if not has_dnstcp then
126 value = value .. "<br />- " ..
127 translate("You should install BIND host package for DNS requests.")
132 -- "DNS requests via TCP not supported"
133 if not has_dnstcp then
134 local dv = s:option(DummyValue, "_no_dnstcp")
135 dv.titleref = DISP.build_url("admin", "system", "packages")
137 dv.title = bold_on ..
138 translate("DNS requests via TCP not supported") .. bold_off
139 dv.value = translate("BusyBox's nslookup does not support to specify to use TCP instead of default UDP when requesting DNS server") ..
141 translate("You should install BIND host package for DNS requests.")