info.htm 1.5 KB

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