From a8d6a99f5b9aa4ce72d9fb1b415727827a3e994b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Wed, 12 Jan 2022 01:36:03 +0100 Subject: [PATCH] gluon-mesh-vpn-wireguard: fix empty string key Co-Authored-By: Matthias Schiffer --- package/gluon-core/luasrc/usr/bin/gluon-info | 4 ++-- .../usr/lib/lua/gluon/mesh-vpn/provider/wireguard.lua | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package/gluon-core/luasrc/usr/bin/gluon-info b/package/gluon-core/luasrc/usr/bin/gluon-info index 8cee2895..c25018d1 100755 --- a/package/gluon-core/luasrc/usr/bin/gluon-info +++ b/package/gluon-core/luasrc/usr/bin/gluon-info @@ -22,8 +22,8 @@ local values = { { 'Hostname', pretty_hostname.get(uci) }, { 'MAC address', sysconfig.primary_mac }, { 'Hardware model', platform.get_model() }, - { 'Gluon version' .. " / " .. 'Site version', util.trim(util.readfile('/lib/gluon/gluon-version')) - .. " / " .. util.trim(util.readfile('/lib/gluon/site-version')) }, + { 'Gluon version / Site version', util.trim(util.readfile('/lib/gluon/gluon-version')) + .. ' / ' .. util.trim(util.readfile('/lib/gluon/site-version')) }, { 'Firmware release', util.trim(util.readfile('/lib/gluon/release')) }, { 'Site', site.site_name() }, { 'Public VPN key', pubkey or 'n/a' }, diff --git a/package/gluon-mesh-vpn-wireguard/luasrc/usr/lib/lua/gluon/mesh-vpn/provider/wireguard.lua b/package/gluon-mesh-vpn-wireguard/luasrc/usr/lib/lua/gluon/mesh-vpn/provider/wireguard.lua index 5065e217..b531b80e 100644 --- a/package/gluon-mesh-vpn-wireguard/luasrc/usr/lib/lua/gluon/mesh-vpn/provider/wireguard.lua +++ b/package/gluon-mesh-vpn-wireguard/luasrc/usr/lib/lua/gluon/mesh-vpn/provider/wireguard.lua @@ -7,7 +7,13 @@ local vpn_core = require 'gluon.mesh-vpn' local M = {} 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 function M.enable(val)