gluon-web-admin: simplify info.html template
This commit is contained in:
parent
13b325355d
commit
fda2d10b6f
@ -9,38 +9,31 @@
|
||||
local platform = require 'gluon.platform'
|
||||
local util = require "gluon.util"
|
||||
|
||||
local _ = translate
|
||||
|
||||
local keys = {
|
||||
hostname = translate('Hostname'),
|
||||
primary_mac = translate('MAC address'),
|
||||
model = translate('Hardware model'),
|
||||
version = translate('Gluon version'),
|
||||
release = translate('Firmware release'),
|
||||
site = translate('Site'),
|
||||
pubkey = translate('Public VPN key'),
|
||||
}
|
||||
|
||||
local values = {
|
||||
hostname = pretty_hostname.get(uci),
|
||||
primary_mac = sysconfig.primary_mac,
|
||||
model = platform.get_model(),
|
||||
version = util.trim(fs.readfile('/lib/gluon/gluon-version')),
|
||||
release = util.trim(fs.readfile('/lib/gluon/release')),
|
||||
site = site.site_name(),
|
||||
pubkey = 'n/a',
|
||||
}
|
||||
|
||||
local pubkey
|
||||
local meshvpn_enabled = uci:get_bool("fastd", "mesh_vpn", "enabled")
|
||||
if meshvpn_enabled then
|
||||
local pubkey = util.trim(lutil.exec('/etc/init.d/fastd show_key mesh_vpn'))
|
||||
if pubkey ~= '' then
|
||||
values.pubkey = pubkey
|
||||
pubkey = util.trim(lutil.exec('/etc/init.d/fastd show_key mesh_vpn'))
|
||||
if pubkey == '' then
|
||||
pubkey = nil
|
||||
end
|
||||
end
|
||||
|
||||
local values = {
|
||||
{ _('Hostname'), pretty_hostname.get(uci) },
|
||||
{ _('MAC address'), sysconfig.primary_mac },
|
||||
{ _('Hardware model'), platform.get_model() },
|
||||
{ _('Gluon version'), util.trim(fs.readfile('/lib/gluon/gluon-version')) },
|
||||
{ _('Firmware release'), util.trim(fs.readfile('/lib/gluon/release')) },
|
||||
{ _('Site'), site.site_name() },
|
||||
{ _('Public VPN key'), pubkey },
|
||||
}
|
||||
-%>
|
||||
<h2><%:Information%></h2>
|
||||
<% for _, key in ipairs({'hostname', 'primary_mac', 'model', 'version', 'release', 'site', 'pubkey'}) do %>
|
||||
<% for _, v in ipairs(values) do %>
|
||||
<div class="gluon-value">
|
||||
<div class="gluon-value-title"><%=keys[key]%></div><div class="gluon-value-field"><%=pcdata(values[key] or 'n/a')%></div>
|
||||
<div class="gluon-value-title"><%=v[1]%></div><div class="gluon-value-field"><%=pcdata(v[2] or 'n/a')%></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user