From e505d65776cbf6669cdd6573983b486a525d6b8a Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Tue, 16 Dec 2025 14:08:55 +0100 Subject: [PATCH] added upload media-files --- .../experience_updated/300-package_janusxr.rb | 217 ++++++++++-------- 1 file changed, 119 insertions(+), 98 deletions(-) diff --git a/manyfold/root/hook.d/experience_updated/300-package_janusxr.rb b/manyfold/root/hook.d/experience_updated/300-package_janusxr.rb index aa15c08..de913bb 100755 --- a/manyfold/root/hook.d/experience_updated/300-package_janusxr.rb +++ b/manyfold/root/hook.d/experience_updated/300-package_janusxr.rb @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require 'json' +require 'erb' require_relative './../../xrforge.rb' # Check if a filename is provided @@ -9,8 +10,17 @@ if ARGV.length != 1 exit 1 end -filename = ARGV[0] +filename = ARGV[0] JMLHeuristic = /.*?<\/fireboxroom>/im +metadataRegex= /(^ - - JML - - data['description'] = data['description'] ? data['description'] : "your description here\n" - data['description'] = <<~DESCRIPTION#{data['description']} - - - - - - - + if model_file + objectSrc = "#{federate_drive_host}/#{dirPublic}/#{model_file.gsub("#","%23")}" + if ! $links.include?(objectSrc) + objectSrc = addLink(objectSrc) + assets += " \n" + objects += " " + end + end -#{jml} - DESCRIPTION + use_local_asset = use_local_asset ? "use_local_asset=\"#{use_local_asset}\"" : "" + + jml = ERB.new( File.read( templateDir+"JML/room.erb" ) ).result(binding) + data['description'] = data['description'] ? data['description'].gsub(metadataRegex,"") : "" + data['description'] += "\n\n" + ERB.new( File.read( templateDir+"JML/header.erb" ) ).result(binding) + data['description'] += jml File.write("datapackage.json", JSON.pretty_generate(data) ) end - html = <<~HTML - - - - #{data['title']} - JanusXR - - - - #{jml} - - - - - - - - - - - - HTML + html = ERB.new( File.read( templateDir+"JML/client.html") ).result(binding) File.write('.xrforge/janusxr.html', html) File.write('.xrforge/scene.jml', jml)