From 067f64382b6fd12798d6983ec8bcf0a332fe19ce Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Wed, 11 Nov 2026 16:34:09 +0100 Subject: [PATCH] icosa.gallery can hotlink now + xrfragment sidecarfile fixes --- src/.lua/apiSync.lua | 5 ++- src/.lua/util.lua | 2 +- src/plugin/diskscan.lua | 7 +++- src/plugin/manyfold.lua | 1 + src/plugin/openbrush.lua | 80 +++++++++++++++++++++++++------------- src/plugin/xrfragments.lua | 3 +- 6 files changed, 68 insertions(+), 30 deletions(-) diff --git a/src/.lua/apiSync.lua b/src/.lua/apiSync.lua index 154c00f..950bf43 100644 --- a/src/.lua/apiSync.lua +++ b/src/.lua/apiSync.lua @@ -30,7 +30,10 @@ local apiSync = { end end, true) if synced > 0 then - app.cache.url = {} -- delete page cache + -- we don't call reset() because that triggers our listener + app.cache.url = {} + app.cache.items = {} + app.cache.dirs = {} app.plugin.diskscan.scan(app.opts.plugin_diskscan_dir) end return synced diff --git a/src/.lua/util.lua b/src/.lua/util.lua index ce1e41d..fed0846 100644 --- a/src/.lua/util.lua +++ b/src/.lua/util.lua @@ -1,6 +1,6 @@ local util = { } -util.fileExist = function(filename) +util.fileExist = function(filename,mode) local file, err = io.open(filename, mode or "r") local exist = false if file then diff --git a/src/plugin/diskscan.lua b/src/plugin/diskscan.lua index d0e5005..7befc1e 100644 --- a/src/plugin/diskscan.lua +++ b/src/plugin/diskscan.lua @@ -191,7 +191,12 @@ return { -- check for directory thumbnail sidecarfile local thumbExt = {"png","jpg","webp"} foreach( thumbExt, function(k,ext) - local files = { fullpath .. '.' .. ext, fullpath .. '/' .. name .. '.' .. ext } + local files = { + fullpath .. '.' .. ext, + fullpath:gsub("%.[a-zA-Z][a-zA-Z][a-zA-Z]$","") .. '.' .. ext, + fullpath .. '/' .. name .. '.' .. ext, + fullpath .. '/' .. name:gsub("%..*","") .. '.' .. ext + } foreach( files, function(kk,thumbnailFile) if util.fileExist( thumbnailFile ) then experience.thumbnail = "/" .. util.stripPath(thumbnailFile) diff --git a/src/plugin/manyfold.lua b/src/plugin/manyfold.lua index 68c63a3..bfbe36a 100644 --- a/src/plugin/manyfold.lua +++ b/src/plugin/manyfold.lua @@ -45,6 +45,7 @@ local sync_URL = app.opts_plugin_manyfold_sync_URL or '' -- this registers the plugin UI local plugin = { name = "ManyFold", + hide = true, -- not finished infowide = true, info = [[ diff --git a/src/plugin/openbrush.lua b/src/plugin/openbrush.lua index 0418aaa..c7d361d 100644 --- a/src/plugin/openbrush.lua +++ b/src/plugin/openbrush.lua @@ -106,8 +106,8 @@ local plugin = { key='app.opts.plugin_openbrush_sync_strategy', title='How to sync', info='download assets locally (prevent linkrot)', - default = "mirror", - values={mirror="mirror locally"} + default = "link", + values={mirror="mirror locally",link="link to URLs"} }, { key='app.opts.plugin_openbrush_sync_when', @@ -120,7 +120,7 @@ local plugin = { key='app.opts.plugin_openbrush_sync_folder', title='Sync to folder', info='openbrush (icosa.gallery) assets will be saved here', - default = "./myverse/tech-demos/tronverse", + default = "./myverse", type = "dir", values = {} -- populated by plugin/diskscan.lua }, @@ -280,7 +280,11 @@ local plugin = { .. [[This virtual world is generated in realtime via icosa.gallery. You can add/create parcels in icosa.gallery, by publishing via OpenBrush, OpenBlocks, or Blender.
-> NOTE: Make sure to add hashtag **]] .. tag .. [[** to the title (and re-run xrforge for fast re-sync). ]] +> NOTE: Make sure to add hashtag **]] .. tag .. [[** to the title (and re-run xrforge for fast re-sync). + +Press the 'Enter XR'-button above for the autogenerated world, or view the individual assets below: + +]] ) end end, @@ -291,7 +295,8 @@ You can add/create parcels in icosa.gallery, by publishing via 0 then + foreach( f.resources, function(k,resource) + local file = dirnameFull .. '/' .. resource.url:gsub(".*/","") + print('🤞 fetch ' .. resource.url) + os.execute('wget "' .. resource.url .. '" -O "' .. file .. '"') + end) + end + synced = synced + 1 + else + print('â„šī¸ ' .. displayName .. ' (up to date) #openbrush') end - print('🤞 fetch ' .. f.root.url) - os.execute('wget "' .. f.root.url .. '" -O "' .. rootfile .. '"') - if #f.resources > 0 then - foreach( f.resources, function(k,resource) - local file = dirnameFull .. '/' .. resource.url:gsub(".*/","") - print('🤞 fetch ' .. resource.url) - os.execute('wget "' .. resource.url .. '" -O "' .. file .. '"') - end) - end - synced = synced + 1 - else - print('â„šī¸ ' .. asset.displayName .. ' (up to date) #openbrush') end + + + if app.opts.plugin_openbrush_sync_strategy == "link" then + print('✅ ' .. displayName .. ' (syncing) #openbrush #link') + local desktopfile = dirnameFull .. '/' .. util.hyphenate( displayName) .. '.desktop' + if not util.fileExist(desktopfile) then + print(desktopfile) + local desktopdata = '[Desktop Entry]\n' + .. 'Type=Link\n' + .. 'Name=' .. (displayName or '') .. '\n' + .. 'URL=' .. (f.root.url or '') .. '\n' + .. 'Icon=' .. (asset.thumbnail.url or '') .. '\n' + util.writefile( desktopfile, desktopdata) + print('✅ writing ' .. desktopfile .. ' #openbrush') + synced = synced + 1 + else + print('â„šī¸ ' .. asset.displayName .. ' (up to date) #openbrush') + end + end + else print('[openbrush.lua] error: no suitable format found for ' .. asset.displayName .. ' ' .. asset.assetId) end diff --git a/src/plugin/xrfragments.lua b/src/plugin/xrfragments.lua index 54b0e57..933e76f 100644 --- a/src/plugin/xrfragments.lua +++ b/src/plugin/xrfragments.lua @@ -32,7 +32,8 @@ app.on('scan_experience_file', function(exp) end) -- set thumbnail if any if exp.sidecarfile.png then - exp.thumbnail = exp.sidecarfile.png + exp.parent.thumbnail = exp.sidecarfile.png + print("✅ └─ plugin/xrfragments: " .. exp.thumbnail .. " thumbnail detected") end local jsonfile = exp.path:gsub("."..ext.."$",".json") -- scan for hrefs in json sidecarfile