info.htm 1.4 KB

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