diff --git a/README.md b/README.md
index 73e4911..359e279 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
XRForge is a tiny, powerful tool to interconnect XR experiences via 3D portals...like a federated viverse.com
-An open, seamless XR web built from simple URLs and directories, without gatekeepers.
+An open, seamless XR web built from simple URLs and directories, without gatekeepers, built upon Next Generation Internet (NGI) specs:
]])
end
end}
- {if parent.parent == nil then
- for i=1,5 do
- local urls = app.opts[ 'plugin_federation_url_' .. i]
- if #urls > 0 then
- local title = urls:gsub(' .*','')
- local fediurl = '/?url=' .. EscapeFragment(title)
- local thumburl = urls:gsub('.* ','')
- local icon = 'list-tree'
- local thumbnail = ''
- if #thumburl > 0 then thumbnail = 'style="background-image: url(' .. EscapeFragment(thumburl) .. ');"' end
- print([[
-
- ]])
- end
+ {if itemsremote then
+ for i=1,#itemsremote do
+ local item = itemsremote[i]
+ local icon = 'link'
+ local thumbnail = ''
+ if #item.thumbnail > 0 then thumbnail = 'style="background-image: url(' .. EscapeFragment( util.stripPath(item.thumbnail) ) .. ');"' end
+ if item.view3D or item.portal3D == false then icon = 'play' end
+ print([[
+
diff --git a/src/page/dir.lua b/src/page/dir.lua
index 132d2bd..d777100 100644
--- a/src/page/dir.lua
+++ b/src/page/dir.lua
@@ -6,17 +6,17 @@ return {
middleware = function(req,res,next)
local rootpath = "/" .. app.opts.plugin_diskscan_dirname
- local urlpath = GetPath()
- res.items = {}
- res.template = res.template or 'page/dir.html'
+ local urlpath = req.url
+ local isroot = urlpath == "/" or urlpath:match("^"..rootpath.."[/]?$")
+ res.items = {}
+ res.template = res.template or 'page/dir.html'
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("%.")
+ if (isroot or urlpath:match("^"..rootpath))
+ and not urlpath:gsub(".*/",""):match("%.") -- no regular file with extension
and not req.param.url then
local redirect = false
@@ -26,10 +26,10 @@ return {
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
@@ -45,7 +45,6 @@ return {
-- add items from dir
if match(v.parent.path, matchpath) then
if v.dir or v.view3D then
- trace("-- dir item: " .. v.path )
local parent = app.cache.items[ v.parent.id ]
res.items[ v.id ] = v
res.parent = parent
@@ -57,32 +56,35 @@ return {
local data = util.merge({
url = req.param.url, -- query hint to render janus.url in iframe (index.html)
- html_items='',
items = {},
parent=res.parent
},{ opts = app.opts })
local i = 0
foreach( res.items, function(k,v)
- -- position items for janusxr JML (dir.html)
+ -- add extra metadata for janusxr JML (janusxr.html and dir.html)
table.insert(data.items, util.merge({x = i*2, i = i},v) )
i=i+1
if v.view3D then
- data.item = v
- data.title = data.item.title
- data.parent = v.parent
- local port = ':' .. GetPort()
- if port == 80 then port = '' end
- data.url = GetScheme() .. '://' .. GetHost() .. port .. v.url
- if v.janusxr and v.janusxr.jml then
- -- what to do here? no generated portals?
- data.janusxr = app.tpl( util.readfile(v.path), data )
+ local isMarkupExperience = function(v)
+ return v.janusxr and (v.janusxr.jml or v.janusxr.aframe)
+ end
+ -- prioritize markup experience above binary 3D files as experience containers
+ if not data.item or (isMarkupExperience(v) and not isMarkupExperience(data.item)) then
+ data.item = v
+ data.title = data.item.title
+ data.parent = v.parent
+ data.url = app.opts.baseurl .. util.stripPath(v.url) -- because we are running in iframe
+ if v.janusxr and (v.janusxr.jml or v.janusxr.aframe) then
+ -- what to do here? no generated portals?
+ data.janusxr = app.tpl( util.readfile(v.path), data )
+ end
end
end
end)
if data.item then
res.template = 'page/index.html'
end
- app.pub("dir", nil, {res=res,data=data, urlpath=urlpath, isdir=isdir})
+ app.pub("dir", nil, {res=res,data=data, urlpath=urlpath, isroot=isroot, isdir=isdir})
if not redirect then
app.cache.url[ urlhash ] = util.templateFile( res.template, data)
end
diff --git a/src/page/footer.html b/src/page/footer.html
index ad6f19b..b3ad9c1 100644
--- a/src/page/footer.html
+++ b/src/page/footer.html
@@ -17,13 +17,20 @@
NLNET