0100-mesh-vpn.lua 986 B

1234567891011121314151617181920212223242526
  1. local uci = luci.model.uci.cursor()
  2. local meshvpn_enabled = uci:get("fastd", "mesh_vpn", "enabled", "0")
  3. if meshvpn_enabled ~= "1" then
  4. return nil
  5. else
  6. local i18n = require "luci.i18n"
  7. local util = require "luci.util"
  8. local site = require 'gluon.site_config'
  9. local sysconfig = require 'gluon.sysconfig'
  10. local pubkey = util.trim(util.exec("/etc/init.d/fastd show_key " .. "mesh_vpn"))
  11. local hostname = uci:get_first("system", "system", "hostname")
  12. local contact = uci:get_first("gluon-node-info", "owner", "contact")
  13. local msg = i18n.translate('gluon-config-mode:pubkey')
  14. return function ()
  15. luci.template.render_string(msg, { pubkey=pubkey
  16. , hostname=hostname
  17. , site=site
  18. , sysconfig=sysconfig
  19. , contact=contact
  20. })
  21. end
  22. end