diff --git a/src/.init.lua b/src/.init.lua
index d4b469c..7616493 100644
--- a/src/.init.lua
+++ b/src/.init.lua
@@ -74,10 +74,7 @@ print = function(...) Log(kLogInfo, ... or "''") end -- nice redbean logging fro
-- init URL router
app.url['^/data'] = '/data.lua' -- setup custom file endpoint
-app.get('^/$', function(req,res,next)
- res.template = 'page/index.html'
- next()
-end)
+app.get('^/$', app.plugin.global.middleware.homepage_2D_or_3D )
app.url['^/admin[/]?$'] = '/page/admin/index.lua'
app.get('^/design[/]?$', util.pagerender('page/design.html'))
diff --git a/src/.lua/config.lua b/src/.lua/config.lua
index dffd1e7..87b5fd1 100644
--- a/src/.lua/config.lua
+++ b/src/.lua/config.lua
@@ -5,7 +5,7 @@ return function(app)
local config = { -- default
name = "XRForge",
baseurl="/",
- admin_title = "xrforge admin panel",
+ admin_title = "admin panel",
admin_subtitle = "Manage your XR experiences here",
}
diff --git a/src/.lua/opendirectory.lua b/src/.lua/opendirectory.lua
index 30e0914..1b9537c 100644
--- a/src/.lua/opendirectory.lua
+++ b/src/.lua/opendirectory.lua
@@ -34,6 +34,7 @@ dir.scan = function(path)
if not stat or not unix.S_ISDIR( stat:mode() ) then
return nil,nil, "not a dir"
end -- let redbean take care of serving static file
+ path = unix.realpath(path)
state,err = assert(unix.opendir(path))
return stat, state, err
end
diff --git a/src/css/xrforge.css b/src/css/xrforge.css
index 6a57737..f30721e 100644
--- a/src/css/xrforge.css
+++ b/src/css/xrforge.css
@@ -14,6 +14,7 @@
.col5{ color:#447; }
.col6{ color:#224; }
.col7{ color:#112; }
+.col8{ color:#000; }
.page{ width:640px; }
diff --git a/src/page/admin/index.lua b/src/page/admin/index.lua
index 94998fd..9137315 100644
--- a/src/page/admin/index.lua
+++ b/src/page/admin/index.lua
@@ -55,7 +55,7 @@ end
app.on('set', function(k,v) -- clear url cache
if k:match("app.opts") then -- after (admin) updates to app.opts.*
foreach( app.cache.url, function(k,v)
- app.cache.url = nil
+ app.cache.url = {}
end)
end
end)
diff --git a/src/page/dir.lua b/src/page/dir.lua
index 9c5d30e..fe7483d 100644
--- a/src/page/dir.lua
+++ b/src/page/dir.lua
@@ -12,21 +12,23 @@ return {
local isdir = urlpath:sub(-1) == "/"
local nslashes = util.countChar('/',urlpath)
local match = function(a,b) return util.stripPath(a) == util.stripPath(b) end
+ local urlhash = urlpath .. util.dump( req.param )
+
if urlpath == "/"
or urlpath:match("^"..rootpath)
and not urlpath:gsub(".*/",""):match("%.") then
local redirect = false
- if not app.cache.url[ urlpath ] then
+ if not app.cache.url[ urlhash ] or util.count(req.params) > 0 then
local matchpath = urlpath
if urlpath == '/' then matchpath = rootpath end -- generate janusxr footer for root url
foreach( app.cache.items, function(k,v)
if req.authenticated or app.plugin.moderation.isAllowed(v) then
if v.parent then
- trace( "path = " .. util.stripPath(v.path) .. " " ..
- "parent = " .. util.stripPath(v.parent.path) .. " " ..
- "matchpath = " .. util.stripPath(matchpath)
- )
+ --trace( "path = " .. util.stripPath(v.path) .. " " ..
+ -- "parent = " .. util.stripPath(v.parent.path) .. " " ..
+ -- "matchpath = " .. util.stripPath(matchpath)
+ --)
if match(v.path, matchpath) then -- show parent folder if any
local parent = app.cache.items[ v.parent.id ]
if v.portal then
@@ -75,7 +77,7 @@ return {
end
app.pub("dir", nil, {res=res,data=data, urlpath=urlpath, isdir=isdir})
if not redirect then
- app.cache.url[ urlpath ] = util.templateFile( res.template, data)
+ app.cache.url[ urlhash ] = util.templateFile( res.template, data)
end
end
if redirect then
@@ -86,7 +88,7 @@ return {
else
res.status(200)
res.header('content-type','text/html')
- res.body( app.cache.url[ urlpath ] )
+ res.body( app.cache.url[ urlhash ] )
next()
end
else
diff --git a/src/page/footer.html b/src/page/footer.html
index 6ff05ad..6699b77 100644
--- a/src/page/footer.html
+++ b/src/page/footer.html
@@ -18,7 +18,7 @@
NLNET