gluon-mesh-vpn-wireguard: fix empty string key

Co-Authored-By: Matthias Schiffer <mschiffer@universe-factory.net>
This commit is contained in:
Maciej Krüger 2022-01-12 01:36:03 +01:00
parent 78ca654c5c
commit a8d6a99f5b
No known key found for this signature in database
GPG Key ID: 0D948CE19CF49C5F
2 changed files with 9 additions and 3 deletions

View File

@ -22,8 +22,8 @@ local values = {
{ 'Hostname', pretty_hostname.get(uci) }, { 'Hostname', pretty_hostname.get(uci) },
{ 'MAC address', sysconfig.primary_mac }, { 'MAC address', sysconfig.primary_mac },
{ 'Hardware model', platform.get_model() }, { 'Hardware model', platform.get_model() },
{ 'Gluon version' .. " / " .. 'Site version', util.trim(util.readfile('/lib/gluon/gluon-version')) { 'Gluon version / Site version', util.trim(util.readfile('/lib/gluon/gluon-version'))
.. " / " .. util.trim(util.readfile('/lib/gluon/site-version')) }, .. ' / ' .. util.trim(util.readfile('/lib/gluon/site-version')) },
{ 'Firmware release', util.trim(util.readfile('/lib/gluon/release')) }, { 'Firmware release', util.trim(util.readfile('/lib/gluon/release')) },
{ 'Site', site.site_name() }, { 'Site', site.site_name() },
{ 'Public VPN key', pubkey or 'n/a' }, { 'Public VPN key', pubkey or 'n/a' },

View File

@ -7,7 +7,13 @@ local vpn_core = require 'gluon.mesh-vpn'
local M = {} local M = {}
function M.public_key() function M.public_key()
return util.trim(util.exec("/lib/gluon/mesh-vpn/wireguard_pubkey.sh")) local key = util.trim(util.exec("/lib/gluon/mesh-vpn/wireguard_pubkey.sh"))
if key == '' then
key = nil
end
return key
end end
function M.enable(val) function M.enable(val)