gluon-web-admin: fix info.html template indentation

This commit is contained in:
Matthias Schiffer 2017-08-11 21:25:46 +02:00
parent 8dbf3ea568
commit fd36bcce07
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C

View File

@ -1,46 +1,46 @@
<%- <%-
local fs = require 'nixio.fs' local fs = require 'nixio.fs'
local uci = require('simple-uci').cursor() local uci = require('simple-uci').cursor()
local lutil = require 'gluon.web.util' local lutil = require 'gluon.web.util'
local pretty_hostname = require 'pretty_hostname' local pretty_hostname = require 'pretty_hostname'
local site = require 'gluon.site_config' local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig' local sysconfig = require 'gluon.sysconfig'
local platform = require 'gluon.platform' local platform = require 'gluon.platform'
local util = require "gluon.util" local util = require "gluon.util"
local keys = { local keys = {
hostname = translate('Hostname'), hostname = translate('Hostname'),
primary_mac = translate('MAC address'), primary_mac = translate('MAC address'),
model = translate('Hardware model'), model = translate('Hardware model'),
version = translate('Gluon version'), version = translate('Gluon version'),
release = translate('Firmware release'), release = translate('Firmware release'),
site = translate('Site'), site = translate('Site'),
pubkey = translate('Public VPN key'), pubkey = translate('Public VPN key'),
} }
local values = { local values = {
hostname = pretty_hostname.get(uci), hostname = pretty_hostname.get(uci),
primary_mac = sysconfig.primary_mac, primary_mac = sysconfig.primary_mac,
model = platform.get_model(), model = platform.get_model(),
version = util.trim(fs.readfile('/lib/gluon/gluon-version')), version = util.trim(fs.readfile('/lib/gluon/gluon-version')),
release = util.trim(fs.readfile('/lib/gluon/release')), release = util.trim(fs.readfile('/lib/gluon/release')),
site = site.site_name, site = site.site_name,
pubkey = 'n/a', pubkey = 'n/a',
} }
local meshvpn_enabled = uci:get_bool("fastd", "mesh_vpn", "enabled") local meshvpn_enabled = uci:get_bool("fastd", "mesh_vpn", "enabled")
if meshvpn_enabled then if meshvpn_enabled then
local pubkey = util.trim(lutil.exec('/etc/init.d/fastd show_key mesh_vpn')) local pubkey = util.trim(lutil.exec('/etc/init.d/fastd show_key mesh_vpn'))
if pubkey ~= '' then if pubkey ~= '' then
values.pubkey = pubkey values.pubkey = pubkey
end end
end end
-%> -%>
<h2><%:Information%></h2> <h2><%:Information%></h2>
<% for _, key in ipairs({'hostname', 'primary_mac', 'model', 'version', 'release', 'site', 'pubkey'}) do %> <% for _, key in ipairs({'hostname', 'primary_mac', 'model', 'version', 'release', 'site', 'pubkey'}) do %>
<div class="gluon-value"> <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"><%=keys[key]%></div><div class="gluon-value-field"><%=pcdata(values[key] or 'n/a')%></div>
</div> </div>
<% end %> <% end %>