diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 4d9883ca..284cc162 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -17,10 +17,9 @@ module("luci.controller.admin.index", package.seeall) function index() local uci_state = luci.model.uci.cursor_state() - local setup_mode = uci_state:get_first("gluon-setup-mode", "setup_mode", "running", "0") == "1" -- Disable gluon-luci-admin when setup mode is not enabled - if not setup_mode then + if uci_state:get_first('gluon-setup-mode', 'setup_mode', 'running', '0') ~= '1' then return end @@ -32,29 +31,9 @@ function index() local page = entry({"admin"}, alias("admin", "index"), "Expert Mode", 10) page.sysauth = "root" - if setup_mode then - -- force root to be logged in when running in setup_mode - page.sysauth_authenticator = function() return "root" end - else - page.sysauth_authenticator = "htmlauth" - end + page.sysauth_authenticator = function() return "root" end page.index = true - entry({"admin", "index"}, cbi("admin/remote"), "Remotezugriff", 1).ignoreindex = true - - if not setup_mode then - entry({"admin", "logout"}, call("action_logout"), "Logout") - end -end - -function action_logout() - local dsp = require "luci.dispatcher" - local sauth = require "luci.sauth" - if dsp.context.authsession then - sauth.kill(dsp.context.authsession) - dsp.context.urltoken.stok = nil - end - - luci.http.header("Set-Cookie", "sysauth=; path=" .. dsp.build_url()) - luci.http.redirect(luci.dispatcher.build_url()) + entry({"admin", "index"}, cbi("admin/info"), _("Info"), 1).ignoreindex = true + entry({"admin", "remote"}, cbi("admin/remote"), _("Remotezugriff"), 10) end diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/info.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/info.lua new file mode 100644 index 00000000..e9ceba70 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/model/cbi/admin/info.lua @@ -0,0 +1,4 @@ +local t = Template('admin/info') +t.pageaction = false + +return t diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm new file mode 100644 index 00000000..5d243a89 --- /dev/null +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/info.htm @@ -0,0 +1,40 @@ +<%- + local fs = require 'luci.fs' + local uci = require('luci.model.uci').cursor() + local util = require 'luci.util' + + local site = require 'gluon.site_config' + local sysconfig = require 'gluon.sysconfig' + local platform = require 'gluon.platform' + + + local keys = { + hostname = 'Hostname', + primary_mac = 'MAC-Adresse', + model = 'Hardware-Modell', + version = 'Gluon-Version', + release = 'Firmware-Release', + site = 'Site', + pubkey = 'Öffentlicher VPN-Schlüssel', + } + + local values = { + hostname = uci:get_first('system', 'system', 'hostname'), + primary_mac = sysconfig.primary_mac, + model = platform.get_model(), + version = util.trim(fs.readfile('/lib/gluon/gluon-version')), + release = util.trim(fs.readfile('/lib/gluon/release')), + site = site.site_name, + } + + local pubkey = util.trim(util.exec('/etc/init.d/fastd show_key mesh_vpn')) + if pubkey ~= '' then + values.pubkey = pubkey + end +-%> +