diff --git a/manyfold/README.md b/manyfold/README.md index 0b3a006..b192394 100644 --- a/manyfold/README.md +++ b/manyfold/README.md @@ -52,6 +52,7 @@ $ manyfold/cli/manyfold run -v ./experiences:/mnt/experiences | `HOMEPAGE` | `/models` | show '/models' URL as homepage (use `/` for manyfold default) | | `THEME` | `default` | bootstrap theme | | `GODOT_VERSION` | `4.4.1-stable`| godot editor version | +| `GODOT_TEMPLATE_ZIP` | `` | godot template zip URL or file (default is empty godot project) | | `RUNTESTS` | `0` | set to `1` to run XRForge related [/test](test) scripts | | `DEV` | `` | enable development mode (disables caching, sets `bin/dev` as entrypoint) | | `NO_PUBLIC_ONLY` | `` | disable public only models | diff --git a/manyfold/cli/manyfold.sh b/manyfold/cli/manyfold.sh index c045044..5987692 100755 --- a/manyfold/cli/manyfold.sh +++ b/manyfold/cli/manyfold.sh @@ -175,7 +175,7 @@ rename_app(){ sed -i 's|powered_by_html:.*|powered_by_html: Radically opensource-powered by XR Forge, Manyfold, XR Fragments and NIX|g' /usr/src/app/config/locales/*.yml sed -i 's|Models|Experiences|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*/*.yml - sed -i 's|Model|Experience|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*.yml + sed -i 's|Model|Experience|g' /usr/src/app/config/locales/*.yml /usr/src/app/config/locales/*/*.yml } start_syslog(){ @@ -232,9 +232,9 @@ boot(){ set_upload_path force_public get_xrfragment_assets - scan_libraries & mount_dir start_hook_daemon + scan_libraries & hook boot # emit unixy hook-event (/root/hook.d/boot/* scripts) # enable development mode (disables template caching etc) diff --git a/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh b/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh index 52770e3..04ed957 100755 --- a/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh +++ b/manyfold/root/hook.d/inotify_MODIFY/package_godot_zip.sh @@ -4,6 +4,8 @@ dir=$(dirname $1) cd "$dir" echo "[package_experience.sh] zipping $dir.zip" -test -d ~/tpl_godot.zip || timeout 50 wget "https://codeberg.org/coderofsalvation/xrfragment-godot/archive/main.zip" -O ~/tpl_godot.zip -cp ~/tpl_godot.zip package_godot.zip +# overwrite empty godot template project-zip with given URL +test -n "$GODOT_TEMPLATE_ZIP" && timeout 50 wget "$GODOT_TEMPLATE_ZIP" -O ~/template_godot.zip + +cp ~/template_godot.zip package_godot.zip zip package_godot.zip *.glb *.usdz *.obj diff --git a/manyfold/root/template_godot.zip b/manyfold/root/template_godot.zip new file mode 100644 index 0000000..4427be0 Binary files /dev/null and b/manyfold/root/template_godot.zip differ diff --git a/manyfold/usr/src/app/app/components/dropdown_item.rb b/manyfold/usr/src/app/app/components/dropdown_item.rb new file mode 100644 index 0000000..999e67e --- /dev/null +++ b/manyfold/usr/src/app/app/components/dropdown_item.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class Components::DropdownItem < Components::Base + include Phlex::Rails::Helpers::LinkTo + + def initialize(icon:, label:, path:, method: nil, aria_label: nil, confirm: nil, target: nil) + @icon = icon + @label = label + @path = path + @method = method + @aria_label = aria_label + @confirm = confirm + @target = target + end + + def view_template + li do + link_to @path, method: @method, class: "dropdown-item", aria: {label: @aria_label}, data: {confirm: @confirm}, target: @target do + Icon(icon: @icon, label: @label) + whitespace + span { @label } + end + end + end +end diff --git a/manyfold/usr/src/app/app/components/model_card.rb b/manyfold/usr/src/app/app/components/model_card.rb index fd178aa..32eeb0d 100644 --- a/manyfold/usr/src/app/app/components/model_card.rb +++ b/manyfold/usr/src/app/app/components/model_card.rb @@ -112,7 +112,7 @@ class Components::ModelCard < Components::Base end div class: "col col-auto" do BurgerMenu do - DropdownItem(icon: "app", label: "Open in Godot Web" , path: "/godot/?url="+"/"+@model.library.name+"/"+@model.path.gsub("#","%23")+"/package_godot.zip", aria_label: translate("components.model_card.edit_button.label", name: @model.name)) + DropdownItem(icon: "app", label: "Open in Godot Web" , path: "/godot/?url="+"/"+@model.library.name+"/"+@model.path.gsub("#","%23")+"/package_godot.zip", aria_label: translate("components.model_card.edit_button.label", name: @model.name), target: "_blank" ) DropdownItem(icon: "pencil", label: t("components.model_card.edit_button.text"), path: model_path(@model), aria_label: translate("components.model_card.edit_button.label", name: @model.name)) DropdownItem(icon: "trash", label: t("components.model_card.delete_button.text"), path: model_path(@model), method: :delete, aria_label: translate("components.model_card.delete_button.label", name: @model.name), confirm: translate("models.destroy.confirm")) if policy(@model).destroy? diff --git a/manyfold/usr/src/app/app/views/models/show.html.erb b/manyfold/usr/src/app/app/views/models/show.html.erb index db0d207..8c4270a 100644 --- a/manyfold/usr/src/app/app/views/models/show.html.erb +++ b/manyfold/usr/src/app/app/views/models/show.html.erb @@ -68,12 +68,18 @@