hints.lua 6.8 KB

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