<%# Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> <% local uci = require "luci.model.uci".cursor() local sys = require "luci.sys" local tpl = require "luci.template" local fs = require "nixio.fs" local http = require "luci.http" local disp = require "luci.dispatcher" local ipkg = require "luci.model.ipkg" local community = uci:get("freifunk", "community", "name") or "Freifunk" local DefaultText = uci:get("freifunk", "community", "DefaultText") or "" local nickname = uci:get("freifunk", "contact", "nickname") or "No Nickname set" -- only redirect if assistent is installed and no root password is set -- we use isfile because the view is not run as root and we can't use -- e.g. ipkg.installed or checkpasswd local webAppRoot = http.getenv("PATH_INFO") == nil local notRunBefore = not uci:get("ffwizard", "settings", "runbefore") local notPasswordSet = true local wizardInstalled = fs.access("/usr/lib/lua/luci/controller/assistent/assistent.lua") if wizardInstalled then local fftools = require "luci.tools.freifunk.assistent.tools" notPasswordSet = not fftools.hasRootPass() end if (webAppRoot and notRunBefore and wizardInstalled) then local url = luci.dispatcher.build_url("admin/freifunk/assistent") if (notPasswordSet) then url = url .. "?luci_username=root&luci_password=" end http.redirect(url) end %> <%+header%> <% local co = "profile_" .. community local community = uci:get_first(co, "community", "name") or "Freifunk" local url = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net" local usertext = fs.readfile("/www/luci-static/index_user.html") if DefaultText ~= "disabled" then defaulttext = '

'.. (translate("Hello and welcome in the network of")).. ' '.. (community or "Freifunk Deutschland").. '!

'.. translate("We are an initiative to establish a free, independent and open wireless mesh network.").. '
'.. translate("This is the access point").. ' '.. luci.sys.hostname().. '. '.. translate("It is operated by").. ' '.. (nickname or translate("Please set your contact information")).. '.

'.. translate("You can find further information about the global Freifunk initiative at").. ' Freifunk.net.
'.. translate("If you are interested in our project then contact the local community").. ' '..community..'.

'.. translate("Notice").. ': '.. translate("Internet access depends on technical and organisational conditions and may or may not work for you.").. '

' end %> <%=defaulttext%> <%=usertext%> <% -- add custom widgets from view/freifunk/widgets local widgets = {} local dir = "/usr/lib/lua/luci/view/freifunk/widgets" uci:foreach("freifunk-widgets", "widget", function(s) if s.enabled == "1" then table.insert(widgets, s) end end) for k, v in ipairs(widgets) do if v['template'] and fs.access(dir .. "/" .. v['template'] .. "/main.htm") then tpl.render("freifunk/widgets/" .. v['template'] .. "/main", { data = v }) end end %> <%+footer%>