1st commit
This commit is contained in:
		
						commit
						33a555ea87
					
				
					 7 changed files with 8631 additions and 0 deletions
				
			
		
							
								
								
									
										57
									
								
								manyfold/manyfold.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								manyfold/manyfold.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
oci=$(which podman || which docker)
 | 
			
		||||
 | 
			
		||||
create_config(){
 | 
			
		||||
  test -d ./config      || mkdir config
 | 
			
		||||
  test -d ./experiences || mkdir experiences
 | 
			
		||||
}
 | 
			
		||||
      
 | 
			
		||||
colorize(){ printf "\033[96m%s\033[0m \033[95m%s\033[0m %s\n" "$1" "$2" "$3"; }
 | 
			
		||||
 | 
			
		||||
debug(){ set -x; "$@"; set +x; }
 | 
			
		||||
 | 
			
		||||
run(){
 | 
			
		||||
  test -x ${oci} || { echo "warning: not running manyfold OCI container [install podman/docker/etc]"; exit; }
 | 
			
		||||
  colorize "[manyfold.sh]" "$(basename ${oci}) detected..starting OCI container"
 | 
			
		||||
  ${oci} rm -f manyfold
 | 
			
		||||
  debug ${oci} run "$@" -d -p 8790:3214 --name manyfold \
 | 
			
		||||
      -v ./config:/config \
 | 
			
		||||
      -v ./experiences:/experiences \
 | 
			
		||||
      -v ./:/root \
 | 
			
		||||
      $(template_overrides) \
 | 
			
		||||
      -e SECRET_KEY_BASE=lkjwljlkwejrlkjek34k234l \
 | 
			
		||||
      -e DATABASE_ADAPTER=sqlite3 \
 | 
			
		||||
      -e SUDO_RUN_UNSAFELY=enabled \
 | 
			
		||||
      -e MULTIUSER=enabled \
 | 
			
		||||
      -e FEDERATION=enabled \
 | 
			
		||||
      -e PUBLIC_HOSTNAME=localhost \
 | 
			
		||||
      -e PUBLIC_PORT=80 \
 | 
			
		||||
      ghcr.io/manyfold3d/manyfold-solo:latest
 | 
			
		||||
  sleep 1
 | 
			
		||||
  patch_manyfold
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template_overrides(){
 | 
			
		||||
  cd manyfold > /dev/null && find * -type f | awk '/.*/ { printf "-v ./manyfold/"$0":/"$0" " }';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
patch_manyfold(){
 | 
			
		||||
  colorize "[manyfold.sh]" "patching.."
 | 
			
		||||
  ${oci} exec manyfold id
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
is_inside_container(){
 | 
			
		||||
  test -d /package/admin && return 0 || return 1 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
usage(){
 | 
			
		||||
  colorize "Usage:" manyfold.sh "<cmd>"
 | 
			
		||||
  colorize "Cmds:"
 | 
			
		||||
  colorize "     " "run [-d]    " "# runs a OCI container (needs podman/docker)"
 | 
			
		||||
  exit 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
is_inside_container || {
 | 
			
		||||
  test -n "$1" && "$@"
 | 
			
		||||
  test -n "$1" || usage
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										79
									
								
								manyfold/usr/src/app/app/views/models/_file.html.erb
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								manyfold/usr/src/app/app/views/models/_file.html.erb
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,79 @@
 | 
			
		|||
<div class="col mb-4">
 | 
			
		||||
  <div class="card preview-card <%= (file === @model.preview_file) ? "border-primary" : "" %>">
 | 
			
		||||
    <h2>FOO</h2>
 | 
			
		||||
    <% if file.is_image? %>
 | 
			
		||||
      <%= content_tag :div, nil, class: "card-img-top card-img-top-background", style: "background-image: url(#{model_model_file_path(@model, file, format: file.extension)})" %>
 | 
			
		||||
      <%= image_tag model_model_file_path(@model, file, format: file.extension), class: "card-img-top image-preview", alt: file.name %>
 | 
			
		||||
    <% elsif file.is_renderable? %>
 | 
			
		||||
      <div class="card-img-top">
 | 
			
		||||
        <%= render Components::Renderer.new(file: file) %>
 | 
			
		||||
      </div>
 | 
			
		||||
    <% else %>
 | 
			
		||||
      <%= content_tag :div, nil, class: "card-img-top", style: "aspect-ratio: 1" do %>
 | 
			
		||||
        <svg height="100%" width="100%" viewBox="0 0 100 100">
 | 
			
		||||
          <path stroke="black" stroke-linecap="round" stroke-width="0.5" fill="white" d="
 | 
			
		||||
            M60,15
 | 
			
		||||
            h-30
 | 
			
		||||
            q-5,0 -5,5
 | 
			
		||||
            v65
 | 
			
		||||
            q0,5 5,5
 | 
			
		||||
            h40
 | 
			
		||||
            q5,0 5,-5
 | 
			
		||||
            v-55
 | 
			
		||||
            L60,15
 | 
			
		||||
          " />
 | 
			
		||||
          <path stroke="black" stroke-linecap="round" stroke-width="0.5" fill="transparent" d="
 | 
			
		||||
            M60,15
 | 
			
		||||
            v10
 | 
			
		||||
            q0,5 5,5
 | 
			
		||||
            h10
 | 
			
		||||
          " />
 | 
			
		||||
          <text x="50%" y="80%" fill="black" dominant-baseline="middle" text-anchor="middle" style="font-size: 8px"><%= file.extension&.upcase %></text>
 | 
			
		||||
        </svg>
 | 
			
		||||
      <% end %>
 | 
			
		||||
    <% end %>
 | 
			
		||||
    <div class="card-body">
 | 
			
		||||
      <div class="card-title">
 | 
			
		||||
        <%= file.name %>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card-text">
 | 
			
		||||
        <% if file.caption %>
 | 
			
		||||
          <p><%= sanitize file.caption %></p>
 | 
			
		||||
        <% end %>
 | 
			
		||||
        <small><code><%= sanitize file.filename %></code></small>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="row">
 | 
			
		||||
        <div class="col">
 | 
			
		||||
          <%= link_to t(".open_button.text"), model_model_file_path(@model, file), {class: "btn btn-primary", "aria-label": translate(".open_button.label", name: file.name)} %>
 | 
			
		||||
          <%= link_to icon("cloud-download", t("general.download")), model_model_file_path(@model, file, file.extension&.to_sym, download: "true"), {class: "btn btn-outline-secondary", download: "download"} %>
 | 
			
		||||
          <% if file.presupported || file.presupported_version %>
 | 
			
		||||
            <%= icon "bar-chart-line-fill", ModelFile.human_attribute_name(:presupported) %>
 | 
			
		||||
          <% end %>
 | 
			
		||||
          <%= problem_icon_tag(file.problems) if policy(Problem).show? %>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col col-auto">
 | 
			
		||||
          <div class="float-end">
 | 
			
		||||
            <div class="btn-group dropup">
 | 
			
		||||
              <a href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
 | 
			
		||||
                <%= icon "three-dots-vertical", t("general.menu") %>
 | 
			
		||||
              </a>
 | 
			
		||||
              <ul class="dropdown-menu dropdown-menu-end">
 | 
			
		||||
                <%= slicer_links(file) if file.is_3d_model? %>
 | 
			
		||||
                <li><hr class="dropdown-divider"></li>
 | 
			
		||||
                <% if file.presupported_version %>
 | 
			
		||||
                <li><h6 class="dropdown-header"><%= t(".presupported") %></h6></li>
 | 
			
		||||
                  <%= link_to t("general.download"), model_model_file_path(@model, file.presupported_version, file.presupported_version.extension&.to_sym, download: "true"), {class: "dropdown-item", download: "download"} %>
 | 
			
		||||
                  <%= slicer_links(file.presupported_version) if file.presupported_version.is_3d_model? %>
 | 
			
		||||
                  <li><hr class="dropdown-divider"></li>
 | 
			
		||||
                <% end %>
 | 
			
		||||
                <li><%= link_to safe_join([icon("pencil-fill", t(".edit")), t(".edit")], " "), edit_model_model_file_path(@model, file), {class: "dropdown-item"} if policy(file).edit? %></li>
 | 
			
		||||
                <li><%= link_to safe_join([icon("image", t(".set_as_preview")), t(".set_as_preview")], " "), model_path(@model, "model[preview_file_id]": file.id), {method: :patch, class: "dropdown-item"} if policy(@model).edit? && file.is_renderable? || file.is_image? %></li>
 | 
			
		||||
                <li><%= link_to safe_join([icon("trash", t(".delete")), t(".delete")], " "), model_model_file_path(@model, file), {method: :delete, class: "dropdown-item", data: {confirm: translate("model_files.destroy.confirm")}} if policy(file).destroy? %></li>
 | 
			
		||||
              </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										37
									
								
								nix/docker.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								nix/docker.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,37 @@
 | 
			
		|||
{ pkgs ? import <nixpkgs> { }
 | 
			
		||||
  , pkgsLinux ? import <nixpkgs> { system = "x86_64-linux"; } 
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
let 
 | 
			
		||||
  vars = import ./vars.nix;
 | 
			
		||||
 | 
			
		||||
  # generate the reproducable blob below via:
 | 
			
		||||
  # $ nix-shell -p nix-prefetch-docker --run 'nix-prefetch-docker ghcr.io/manyfold3d/manyfold-solo 0.117.0'
 | 
			
		||||
  manyfoldImage = pkgs.dockerTools.pullImage {
 | 
			
		||||
    imageName = "ghcr.io/manyfold3d/manyfold-solo";
 | 
			
		||||
    imageDigest = "sha256:95ae855376eb075bd718018e09eeee2735eece87d26c392abd0d63c38c8db44b";
 | 
			
		||||
    sha256 = "0na33qdll24cp4lc77dcmf3pi5s521gjrfqlahq52aw5vjapknfp";
 | 
			
		||||
    finalImageName = "ghcr.io/manyfold3d/manyfold-solo";
 | 
			
		||||
    finalImageTag = "0.117.0";
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  foo = pkgs.dockerTools.buildImage {
 | 
			
		||||
 | 
			
		||||
    name = "xrforge";
 | 
			
		||||
    tag = "latest";
 | 
			
		||||
    fromImage = manyfoldImage;
 | 
			
		||||
 | 
			
		||||
    # add nix pkgs + local files
 | 
			
		||||
    copyToRoot = pkgs.buildEnv {
 | 
			
		||||
      name = "image-root";
 | 
			
		||||
      pathsToLink = ["/manyfold" "/bin"];
 | 
			
		||||
      paths = [pkgs.git ./..];
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    config = {
 | 
			
		||||
      Cmd = ["${pkgsLinux.hello}/bin/hello" ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								nix/vars.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								nix/vars.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
# sources.nix
 | 
			
		||||
# This file defines external sources used in your Nix builds.
 | 
			
		||||
 | 
			
		||||
{ pkgs }: # Takes the pkgs argument to use pkgs.fetchgit
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  # Define the manyfold source using pkgs.fetchgit
 | 
			
		||||
  # This fetches the specified Git repository at a particular commit for reproducibility.
 | 
			
		||||
  manyfold = pkgs.fetchgit {
 | 
			
		||||
    url = "https://github.com/manyfold3d/manyfold";
 | 
			
		||||
    rev = "716a57b216a471b1d481c69056dccb5ad48f039c"; # Specific commit hash
 | 
			
		||||
    sha256 = "sha256-ZhbVMkueZ0zakMO8FoXkClkN/q/KMj+OZcIhnmJWi2I="; # SHA256 hash of the fetched content
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
  # Expose the manyfold derivation.
 | 
			
		||||
  # You can add more sources here as needed, e.g., other git repos, local paths, etc.
 | 
			
		||||
  inherit manyfold;
 | 
			
		||||
  foo = "bar";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								shell.nix
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								shell.nix
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
nix/shell.nix
 | 
			
		||||
							
								
								
									
										8430
									
								
								xrforge.excalidraw
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8430
									
								
								xrforge.excalidraw
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										5
									
								
								xrforge.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								xrforge.svg
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| 
		 After Width: | Height: | Size: 276 KiB  | 
		Loading…
	
	Add table
		
		Reference in a new issue