info.htm 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <%-
  2. local fs = require 'nixio.fs'
  3. local uci = require('luci.model.uci').cursor()
  4. local util = require 'luci.util'
  5. local i18n = require 'luci.i18n'
  6. local site = require 'gluon.site_config'
  7. local sysconfig = require 'gluon.sysconfig'
  8. local platform = require 'gluon.platform'
  9. local keys = {
  10. hostname = i18n.translate('Hostname'),
  11. primary_mac = i18n.translate('MAC address'),
  12. model = i18n.translate('Hardware model'),
  13. version = i18n.translate('Gluon version'),
  14. release = i18n.translate('Firmware release'),
  15. site = i18n.translate('Site'),
  16. pubkey = i18n.translate('Public VPN key'),
  17. }
  18. local values = {
  19. hostname = uci:get_first('system', 'system', 'hostname'),
  20. primary_mac = sysconfig.primary_mac,
  21. model = platform.get_model(),
  22. version = util.trim(fs.readfile('/lib/gluon/gluon-version')),
  23. release = util.trim(fs.readfile('/lib/gluon/release')),
  24. site = site.site_name,
  25. pubkey = 'n/a',
  26. }
  27. local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0")
  28. if meshvpn_enabled == "1" then
  29. local pubkey = util.trim(util.exec('/etc/init.d/fastd show_key mesh_vpn'))
  30. if pubkey ~= '' then
  31. values.pubkey = pubkey
  32. end
  33. end
  34. -%>
  35. <h2><%:Information%></h2>
  36. <% for _, key in ipairs({'hostname', 'primary_mac', 'model', 'version', 'release', 'site', 'pubkey'}) do %>
  37. <div class="cbi-value">
  38. <div class="cbi-value-title"><%=keys[key]%></div><div class="cbi-value-field"><%=values[key] or 'n/a'%></div>
  39. </div>
  40. <% end %>