Skip to content
Snippets Groups Projects
Commit b5a8959f authored by Sunz3r's avatar Sunz3r Committed by Matthias Schiffer
Browse files

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

parent d72a1ea9
No related branches found
No related tags found
No related merge requests found
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 fs = require "nixio.fs"
local site = require 'gluon.site_config' local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig' local sysconfig = require 'gluon.sysconfig'
...@@ -8,7 +9,10 @@ local util = require "gluon.util" ...@@ -8,7 +9,10 @@ local util = require "gluon.util"
local pretty_hostname = require 'pretty_hostname' 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 hostname = pretty_hostname.get(uci)
local contact = uci:get_first("gluon-node-info", "owner", "contact") local contact = uci:get_first("gluon-node-info", "owner", "contact")
...@@ -16,11 +20,20 @@ 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 pubkey
local msg local msg
if meshvpn_enabled then
pubkey = util.trim(lutil.exec("/etc/init.d/fastd show_key mesh_vpn")) if has_tunneldigger then
msg = _translate('gluon-config-mode:pubkey') local tunneldigger_enabled = uci:get_bool("tunneldigger", "mesh_vpn", "enabled")
else if not tunneldigger_enabled then
msg = _translate('gluon-config-mode:novpn') 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 end
if not msg then return end if not msg then return end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment