🔧 master: work in progress [might break]
This commit is contained in:
parent
5c5e0827e4
commit
b52b157eff
3 changed files with 13 additions and 4 deletions
|
|
@ -74,8 +74,10 @@ return {
|
|||
res.template = 'page/index.html'
|
||||
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)
|
||||
end
|
||||
end
|
||||
if redirect then
|
||||
print("REDIRECT! " .. redirect )
|
||||
res.status(303)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
local center = -((#items*width)/1.3) + (i*width)
|
||||
local url = v.url
|
||||
if v.dir then url = url .. "/" end
|
||||
if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr
|
||||
addPortal('dir',center, v, url,i, -4, 'img', '0 0 0', '0.2 0.2 0.2')
|
||||
end
|
||||
end}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,16 @@ local json = require('json')
|
|||
app.on('init', function()
|
||||
end)
|
||||
|
||||
app.on('dir', function(opts)
|
||||
end)
|
||||
|
||||
app.on('scan_experience_file', function(exp)
|
||||
local me = app.plugin.xrfragments
|
||||
foreach( util.split( app.opts.plugin_xrfragments_filetypes, ' '), function(k,ext)
|
||||
if exp.path:lower():match("."..ext.."$") then
|
||||
exp.view3D = true
|
||||
local hasHref = false
|
||||
if ext == 'glb' then
|
||||
exp.view3D = true
|
||||
-- detect XR Fragment exp https://xrfragment.org/#%F0%9F%93%9C%20level0%3A%20File
|
||||
local tree = me.extract_glb_json( util.stripPath(exp.path) )
|
||||
hasHref = me.detectHrefInStruct(tree)
|
||||
|
|
@ -32,10 +35,13 @@ app.on('scan_experience_file', function(exp)
|
|||
if util.fileExist( jsonfile ) then
|
||||
exp.sidecarfile.JSONXRF = me.detectHrefInStruct( json.decode( util.readfile(jsonfile) ) )
|
||||
end
|
||||
exp.tag.xrfragments = hasHref or hasPNG or hasWebVTT or hasOGG or hasJSONref
|
||||
if exp.tag.xrfragments then
|
||||
exp.tag.xrfragments = { qualify = hasHref or hasPNG or hasWebVTT or hasOGG or hasJSONref, href = hasHref }
|
||||
if exp.tag.xrfragments.qualify then
|
||||
print("✅ └─ plugin/xrfragments: detected xrfragments experience")
|
||||
end
|
||||
if exp.tag.xrfragments.href then
|
||||
exp.parent.redirect = exp.url -- mark parent to redirect to this standalone url instead
|
||||
end
|
||||
foreach(exp.sidecarfile, function(ext,v)
|
||||
print("✅ └─ plugin/xrfragments: detected .".. ext:lower() .. " sidecarfile")
|
||||
end)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue