2026-08-06 16:43:17 +02:00
|
|
|
{if true then
|
2026-09-11 18:42:12 +02:00
|
|
|
wrapperfile = (parent and parent.path or '') .. '/' .. app.opts.plugin_janusxr_wrap_custom
|
|
|
|
|
hasWrapperfile = util.fileExist(wrapperfile) and true or false
|
2026-09-04 16:34:57 +02:00
|
|
|
showfediportals = app.opts.plugin_federation_strategy == 'always' or
|
|
|
|
|
(app.opts.plugin_federation_strategy == 'homepage' and urlpath == '/')
|
2026-08-18 22:21:48 +02:00
|
|
|
|
|
|
|
|
-- optimize janus resource URLs for archive.org
|
|
|
|
|
app.plugin.archive.flush()
|
|
|
|
|
function URL(url)
|
2026-08-19 18:36:28 +02:00
|
|
|
url = util.baseURLify(url)
|
2026-08-18 22:21:48 +02:00
|
|
|
app.plugin.archive.add(url)
|
|
|
|
|
return url
|
|
|
|
|
end
|
2026-08-06 16:43:17 +02:00
|
|
|
|
2026-08-19 18:36:28 +02:00
|
|
|
end}
|
2026-08-06 16:43:17 +02:00
|
|
|
|
2026-08-04 12:17:33 +02:00
|
|
|
<fireboxroom>
|
|
|
|
|
<assets>
|
2026-08-19 18:36:28 +02:00
|
|
|
{if defined(items) and #items > 0 then
|
2026-08-04 12:17:33 +02:00
|
|
|
for i,v in pairs(items) do
|
2026-08-11 17:47:40 +02:00
|
|
|
if #v.thumbnail > 0 then
|
2026-08-18 22:21:48 +02:00
|
|
|
print('\t<assetimage src="' .. URL(v.thumbnail) .. '" id="img' .. i .. '"/>')
|
2026-08-11 17:47:40 +02:00
|
|
|
end
|
2026-08-04 12:17:33 +02:00
|
|
|
end
|
|
|
|
|
end}
|
2026-08-19 18:36:28 +02:00
|
|
|
{if defined(itemsremote) and #itemsremote > 0 then
|
2026-08-17 13:42:27 +02:00
|
|
|
for i,v in pairs(itemsremote) do
|
|
|
|
|
if #v.thumbnail > 0 then
|
2026-08-18 22:21:48 +02:00
|
|
|
print('\t<assetimage src="' .. URL(v.thumbnail) .. '" id="imgremote' .. i .. '"/>')
|
2026-08-17 13:42:27 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end}
|
2026-08-06 16:43:17 +02:00
|
|
|
{if showfediportals then
|
|
|
|
|
for i=1,5 do
|
|
|
|
|
local urls = app.opts[ 'plugin_federation_url_' .. i]
|
|
|
|
|
if #urls > 0 then
|
|
|
|
|
local fediurl = urls:gsub(' .*','')
|
|
|
|
|
local thumburl = urls:gsub('.* ','')
|
2026-08-18 22:21:48 +02:00
|
|
|
print('\t<assetimage src="' .. URL(thumburl) .. '" id="federated' .. i .. '"/>')
|
2026-08-06 16:43:17 +02:00
|
|
|
end
|
2026-08-04 12:17:33 +02:00
|
|
|
end
|
|
|
|
|
end}
|
|
|
|
|
</assets>
|
2026-08-19 18:36:28 +02:00
|
|
|
{if true then
|
2026-08-24 13:29:35 +02:00
|
|
|
local room = ''
|
|
|
|
|
pos = '0 0 0'
|
|
|
|
|
if not defined(item) and defined(items) then
|
|
|
|
|
room = app.opts.plugin_janusxr_portalroom
|
2026-08-11 17:47:40 +02:00
|
|
|
end
|
2026-09-11 18:42:12 +02:00
|
|
|
|
|
|
|
|
function initRoom(i)
|
|
|
|
|
if i.janusxr and i.janusxr.room then
|
|
|
|
|
pos = '0 0 1' -- todo make startup location configurable
|
|
|
|
|
room = i.janusxr.room
|
|
|
|
|
end
|
2026-08-24 13:29:35 +02:00
|
|
|
end
|
2026-09-11 18:42:12 +02:00
|
|
|
initRoom(item or {})
|
|
|
|
|
initRoom(itemdir or {})
|
|
|
|
|
|
|
|
|
|
if (hasWrapperfile == true) or (defined(item) and item.tag.xrfragments and item.tag.xrfragments.href) then
|
2026-08-19 18:36:28 +02:00
|
|
|
room = '' -- xrfragments 3D files dont need to be wrapped with room
|
|
|
|
|
end
|
2026-08-24 13:29:35 +02:00
|
|
|
print(' <room skybox="true" pos="' .. pos .. '" showavatar="false" use_local_asset="' .. room .. '">')
|
2026-08-19 18:36:28 +02:00
|
|
|
if defined(item) then
|
2026-08-24 13:29:35 +02:00
|
|
|
print(' <object id="${item.url}"/>')
|
2026-08-19 18:36:28 +02:00
|
|
|
end
|
2026-08-04 12:17:33 +02:00
|
|
|
end}
|
|
|
|
|
<light js_id="dan9-janus:light/light_cone_angle=0-6" pos="0 3 2" collision_trigger="false" />
|
|
|
|
|
<text js_id="location" pos="0 6 -5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${url}" emissive="0 0 0" roughness="0.3" metalness="0" />
|
2026-08-19 18:36:28 +02:00
|
|
|
{if not defined(item) and defined(items) and #items > 0 then
|
2026-09-11 18:42:12 +02:00
|
|
|
local layout = itemdir.layout or ''
|
|
|
|
|
if #layout > 0 and app.plugin.janusxr.layout[ layout ] then
|
|
|
|
|
print( app.plugin.janusxr.layout[ layout ].render(items) )
|
|
|
|
|
else
|
|
|
|
|
print( app.plugin.janusxr.layout.portals.render(items) )
|
2026-08-04 12:17:33 +02:00
|
|
|
end
|
|
|
|
|
end}
|
2026-08-19 18:36:28 +02:00
|
|
|
{if not defined(item) and defined(itemsremote) and #itemsremote > 0 then
|
2026-08-17 13:42:27 +02:00
|
|
|
for i,v in pairs(itemsremote) do
|
2026-09-11 18:42:12 +02:00
|
|
|
local width = v.portal_width or tonumber( app.opts.plugin_global_portal_width )
|
2026-08-18 22:21:48 +02:00
|
|
|
local center = -((#itemsremote*width)/1.3) + (i*width)
|
|
|
|
|
local url = v.url
|
2026-09-11 18:42:12 +02:00
|
|
|
local thumb = ' shader_id="defaultportal"'
|
2026-08-17 13:42:27 +02:00
|
|
|
if #v.thumbnail > 0 then
|
|
|
|
|
thumb = ' thumb_id="imgremote' .. i .. '" '
|
|
|
|
|
end
|
|
|
|
|
if v.dir then url = url .. "/" end
|
|
|
|
|
if v.redirect then url = v.redirect end -- dont wrap standalone glb's in janusxr
|
2026-09-11 18:42:12 +02:00
|
|
|
print( app.plugin.janusxr.addPortal('remote',center, v, url,i, 4, thumb, '0 180 0', '0.2 0.2 0.2') )
|
2026-08-04 12:17:33 +02:00
|
|
|
end
|
2026-08-17 13:42:27 +02:00
|
|
|
print([[
|
|
|
|
|
<text js_id="locationremote" pos="0 6 5" billboard="y" col="#BBFFFF" scale="10 10 1" text="${opts.plugin_global_remote_title}" emissive="0 0 0" roughness="0.3" metalness="0" />
|
|
|
|
|
]])
|
2026-08-04 12:17:33 +02:00
|
|
|
end}
|
2026-08-17 13:42:27 +02:00
|
|
|
|
2026-08-19 18:36:28 +02:00
|
|
|
{if #referrer > 0 then
|
|
|
|
|
-- hardcoded reciprocal portal
|
|
|
|
|
local v = {
|
|
|
|
|
url = referrer,
|
|
|
|
|
title = app.opts.plugin_janusxr_portal_up,
|
|
|
|
|
}
|
2026-09-11 18:42:12 +02:00
|
|
|
print( app.plugin.janusxr.addPortal('parent',5, v, v.url, 0, 0, ' shader_id="defaultportal"', '0 -90 0', '0.2 0.2 0.2') )
|
2026-08-19 18:36:28 +02:00
|
|
|
end}
|
|
|
|
|
|
2026-09-11 18:42:12 +02:00
|
|
|
{if os.getenv('DEBUG') then
|
2026-08-25 13:04:06 +02:00
|
|
|
|
|
|
|
|
local plugins = {}
|
|
|
|
|
foreach(app.plugin, function(name,p)
|
|
|
|
|
if not tostring(name):match("[0-9]") then table.insert(plugins,name) end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
local embedsrc = EscapeFragment(
|
|
|
|
|
"config\n======\n" ..
|
|
|
|
|
util.dump({
|
|
|
|
|
plugins = plugins,
|
|
|
|
|
host = app.host,
|
|
|
|
|
protocol = app.scheme,
|
|
|
|
|
convert_assimp_filetypes_in = app.opts.plugin_convert_assimp_filetypes_in,
|
|
|
|
|
convert_assimp_filetypes_out = app.opts.plugin_convert_assimp_filetypes_out,
|
|
|
|
|
janusxr_portalroom = app.opts.plugin_janusxr_wrap_video,
|
|
|
|
|
janusxr_wrap_3dfile = app.opts.plugin_janusxr_wrap_3dfile,
|
|
|
|
|
janusxr_wrap_video = app.opts.plugin_janusxr_wrap_video,
|
|
|
|
|
janusxr_wrap_aframe = app.opts.plugin_janusxr_wrap_aframe,
|
|
|
|
|
janusxr_janusweb_corsproxies = util.split("https://p.janusxr.org https://cors.xrforge.org"," ")
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
print([[
|
|
|
|
|
<text text="Server statistics" position="-3 2.5 0" scale="3 3 3" rotation="0 90 0"/>
|
|
|
|
|
<paragraph id="encoded" url="/statusz" rotation="0 90 0" use_proxy="false" cull_face='none' position="-3 1 0.7" width="400" height="900" scale="0.6 1.2 1" lighting="false" css=".paragraphcontainer{height:100%; white-space: pre ; display: block; unicode-bidi: embed; border-radius:10px; background:#000; color:#AFF; font-family:monospace; padding:20px;}"/>
|
|
|
|
|
|
|
|
|
|
<paragraph id="encoded" rotation="0 90 0" url="data:text/plain,]] .. embedsrc .. [[" use_proxy="false" cull_face='none' position="-3 1 -0.7" width="400" height="900" scale="0.6 1.2 1" lighting="false" css=".paragraphcontainer{height:100%; white-space: pre ; display: block; unicode-bidi: embed; border-radius:10px; background:#000; color:#FAF; font-family:monospace; padding:20px;"/>
|
|
|
|
|
]])
|
|
|
|
|
end}
|
|
|
|
|
|
2026-08-24 13:29:35 +02:00
|
|
|
<object id="cube" rotation="0 45 0" pos="${pos}" scale="2 0.1 2"/> <!-- something to stand on -->
|
2026-09-11 18:42:12 +02:00
|
|
|
{if not defined(item) and hasWrapperfile == false then
|
2026-08-19 18:36:28 +02:00
|
|
|
print('${janusxr_jml_deco}')
|
|
|
|
|
end}
|
2026-09-11 18:42:12 +02:00
|
|
|
{if hasWrapperfile == true then
|
|
|
|
|
local wrapperURL = util.stripPath( parent.path .. '/' .. app.opts.plugin_janusxr_wrap_custom)
|
2026-09-04 16:34:57 +02:00
|
|
|
print(' <!-- inserted by XRForge server: ' .. app.opts.plugin_janusxr_wrap_custom .. ' -->')
|
2026-09-11 18:42:12 +02:00
|
|
|
print(' <link url="' .. wrapperURL .. '" url_pos="0 0 0" pos="0 0 1" url_scale="1 1 1" js_id="index_jml" auto_load="true" />')
|
2026-09-04 16:34:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
end}
|
|
|
|
|
{if #opts.plugin_janusxr_jml > 0 then
|
|
|
|
|
print(' <!-- inserted by XRForge server: janusxr admin (Extra JML) -->')
|
|
|
|
|
print(' ' .. app.opts.plugin_janusxr_jml)
|
|
|
|
|
end}
|
2026-08-04 12:17:33 +02:00
|
|
|
</room>
|
|
|
|
|
</fireboxroom>
|
2026-08-18 22:21:48 +02:00
|
|
|
|
|
|
|
|
{if #app.plugin.archive.url > 0 then
|
|
|
|
|
print('<!-- this is purely to optimize JanusXR resource-URLs to (archive.org) scrapers -->')
|
|
|
|
|
print("<div style='display:none'>")
|
|
|
|
|
for k,url in pairs(app.plugin.archive.url) do
|
|
|
|
|
print(' <a href="' .. url .. '"></a>')
|
|
|
|
|
end
|
|
|
|
|
print("</div>")
|
|
|
|
|
end}
|