gluon-config-mode-mesh-vpn: add tunneldigger to reboot page (#1172)

This commit is contained in:
Sunz3r 2017-07-06 13:24:15 +02:00 committed by Matthias Schiffer
parent 113688d83d
commit 568997f10f
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
1 changed files with 19 additions and 6 deletions

View File

@ -1,5 +1,6 @@
local uci = require("simple-uci").cursor()
local lutil = require "gluon.web.util"
local fs = require "nixio.fs"
local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig'
@ -8,7 +9,10 @@ local util = require "gluon.util"
local pretty_hostname = require 'pretty_hostname'
local meshvpn_enabled = uci:get_bool("fastd", "mesh_vpn", "enabled")
local has_fastd = fs.access('/lib/gluon/mesh-vpn/fastd')
local has_tunneldigger = fs.access('/lib/gluon/mesh-vpn/tunneldigger')
local hostname = pretty_hostname.get(uci)
local contact = uci:get_first("gluon-node-info", "owner", "contact")
@ -16,11 +20,20 @@ local contact = uci:get_first("gluon-node-info", "owner", "contact")
local pubkey
local msg
if meshvpn_enabled then
pubkey = util.trim(lutil.exec("/etc/init.d/fastd show_key mesh_vpn"))
msg = _translate('gluon-config-mode:pubkey')
else
msg = _translate('gluon-config-mode:novpn')
if has_tunneldigger then
local tunneldigger_enabled = uci:get_bool("tunneldigger", "mesh_vpn", "enabled")
if not tunneldigger_enabled then
msg = _translate('gluon-config-mode:novpn')
end
elseif has_fastd then
local fastd_enabled = uci:get_bool("fastd", "mesh_vpn", "enabled")
if fastd_enabled then
pubkey = util.trim(lutil.exec("/etc/init.d/fastd show_key mesh_vpn"))
msg = _translate('gluon-config-mode:pubkey')
else
msg = _translate('gluon-config-mode:novpn')
end
end
if not msg then return end