{if items then
+
+ function getURL(url)
+ if app.arg[1] == 'generate' and url:match("://") then
+ url = 'janusweb/index.html#janus.url=' ..
+ EscapeFragment( url ) .. '&janus.referrer=' .. util.getURL(urlpath )
+ url = util.baseURLify(url)
+ else
+ url = util.stripPath( url )
+ end
+ return url
+ end
+
for i=1,#items do
local item = items[i]
local visible = item.view2D == nil or (item.view2D ~= nil and item.view2D ~= false)
@@ -29,10 +41,10 @@ end}
if item.view3D or item.portal3D == false then icon = 'play' end
print([[
@@ -49,10 +61,10 @@ 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 186dd20..b01c83d 100644
--- a/src/page/dir.lua
+++ b/src/page/dir.lua
@@ -13,11 +13,12 @@ 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 )
+ local urlhash = urlpath .. util.dump( req.param )
+ local referrer = util.baseURLify( (isroot and not req.param.url) and "" or urlpath )
if (isroot or urlpath:match("^"..rootpath))
and not urlpath:gsub(".*/",""):match("%.") -- no regular file with extension
- and not req.param.url then
+ then
local redirect = false
if not app.cache.url[ urlhash ] or util.count(req.params) > 0 then
@@ -45,14 +46,10 @@ return {
res.items[ v.id ] = v
res.parent = parent
end
- if not isroot then
- res.items[ v.parent.id ] = {
- view2D = false,
- url = v.parent.parent.url,
- title = app.opts.plugin_janusxr_portal_up,
- name = app.opts.plugin_janusxr_portal_up,
- thumbnail = '',
- }
+ if isroot then
+ referrer = app.opts.plugin_federation_parent_url
+ else
+ referrer = v.parent.parent.url
end
end
end
@@ -62,7 +59,8 @@ return {
local data = util.merge({
url = req.param.url, -- query hint to render janus.url in iframe (index.html)
items = {},
- referrer = isroot and app.opts.plugin_federation_parent_url or util.getURL(),
+ isroot = isroot,
+ referrer = referrer,
parent=res.parent,
template=res.template
},{ opts = app.opts })
@@ -78,7 +76,7 @@ return {
-- prioritize markup experience above binary 3D files as experience containers
if not data.item or (isMarkupExperience(v) and not isMarkupExperience(data.item)) then
-- update referrer url
- data.referrer = util.getURL( v.view3D and v.parent.parent.url or v.parent.url )
+ data.referrer = util.baseURLify(v.view3D and v.parent.parent.url or v.parent.url)
data.item = v
data.title = data.item.title
data.parent = v.parent
diff --git a/src/page/header.html b/src/page/header.html
index 697194c..a98159f 100644
--- a/src/page/header.html
+++ b/src/page/header.html
@@ -21,7 +21,7 @@
[<>] ${opts.plugin_global_title}
- {if url:match("admin") then
+ {if urlpath:match("^/admin") then
print('//')
print('${opts.admin_title}')
end}
@@ -38,7 +38,16 @@
print( app.opts.plugin_global_topmenu_html:gsub("\n"," ") )
end}
{if template == "page/dir.html" then
- print([[ ]])
+ local url = urlpath
+ if not urlpath:match(app.opts.plugin_diskscan_dirname) then
+ -- janusweb workaround (it does not support '/' url somehow)
+ urlpath = urlpath .. app.opts.plugin_diskscan_dirname
+ end
+ if app.arg[1] == "generate" then
+ print([[ ]])
+ else
+ print([[ ]])
+ end
end}
{if template == "page/index.html" then
local sharedata = {
diff --git a/src/page/index.html b/src/page/index.html
index 6a83bb8..8ed8d73 100644
--- a/src/page/index.html
+++ b/src/page/index.html
@@ -5,7 +5,7 @@ ${header}
-{if item and item.parent and item.parent.info then
+{if defined(item) and item.parent and item.parent.info then
print([[