gluon-config-mode-mesh-vpn: add tunneldigger to reboot page (#1172)
This commit is contained in:
parent
d72a1ea9c6
commit
b5a8959f59
@ -1,5 +1,6 @@
|
|||||||
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"
|
|||||||
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")
|
|||||||
local pubkey
|
local pubkey
|
||||||
local msg
|
local msg
|
||||||
|
|
||||||
if meshvpn_enabled then
|
|
||||||
|
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"))
|
pubkey = util.trim(lutil.exec("/etc/init.d/fastd show_key mesh_vpn"))
|
||||||
msg = _translate('gluon-config-mode:pubkey')
|
msg = _translate('gluon-config-mode:pubkey')
|
||||||
else
|
else
|
||||||
msg = _translate('gluon-config-mode:novpn')
|
msg = _translate('gluon-config-mode:novpn')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not msg then return end
|
if not msg then return end
|
||||||
|
Loading…
Reference in New Issue
Block a user