vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Render images and 3D models in the browser views
3b2bcc30534f24b4628b6365e69dcb9065115065 · Keenan Nemetz · 13d ago · parent 87bab8e1
Render images and 3D models in the browser views A blob whose name is an image is served as that image, so the <img> a README already emitted works and the source view can show it. An SVG keeps its source view and previews on request. The instance introduction resolves assets/, so a landing-page picture is no longer a broken link. A changed image or model shows both sides in the commit, compare, and change request diffs, where git only says "binary". The 3D viewer is a vendored three.js bundle, loaded only when a page has a model, with a download fallback for a reader without JavaScript or WebGL. closes: 01M7XQ9AKKKFNEX0F679JRRYQD
server/web/templates/diff.html +35−2
| @@ -8,14 +8,47 @@ | |||
| 8 | 8 | {{if ne (len .Files) 1}}<div class="diffsum muted">{{len .Files}} file{{if ne (len .Files) 1}}s{{end}} changed{{if .Added}} · <span class="adds">+{{.Added}}</span>{{end}}{{if .Removed}} · <span class="dels">−{{.Removed}}</span>{{end}}</div>{{end}} | |
| 9 | 9 | {{range .Files}} | |
| 10 | 10 | {{$file := .}} | |
| 11 | {{$old := .OldMedia}}{{$new := .NewMedia}} | ||
| 11 | 12 | <section class="diff"{{if .Language}} data-highlight="{{.Language}}"{{end}}> | |
| 12 | 13 | <h3> | |
| 13 | 14 | <span class="path">{{if and .OldPath .NewPath (ne .OldPath .NewPath)}}{{.OldPath}} → {{end}}{{.Label}}</span>{{if .Binary}}<span class="label">binary</span>{{end}} | |
| 14 | 15 | <span class="diffstat">{{if .Added}}<span class="adds">+{{.Added}}</span>{{end}}{{if .Removed}}<span class="dels">−{{.Removed}}</span>{{end}}</span> | |
| 15 | 16 | </h3> | |
| 16 | {{if .Binary}} | ||
| 17 | <p class="binary">Binary file: no line diff to show. Use <code>git show</code> to inspect it.</p> | ||
| 17 | {{/* A picture or a model has no lines to read, so git calls it binary. The | ||
| 18 | two sides are still in the repository, and the raw route can show both | ||
| 19 | of them; the line diff stays below for an SVG, an OBJ or a glTF, which | ||
| 20 | git does read as text. */}} | ||
| 21 | {{if or $old.Src $new.Src}} | ||
| 22 | <div class="media-diff"> | ||
| 23 | {{if $old.Src}} | ||
| 24 | <figure> | ||
| 25 | {{if $old.Model}} | ||
| 26 | <div class="model-viewer" data-model="{{$old.Src}}" data-format="{{$old.Format}}" data-title="{{$file.Label}} before"> | ||
| 27 | <p class="model-fallback"><a href="{{$old.Src}}">Download</a> the before model to open it in a 3D application.</p> | ||
| 28 | </div> | ||
| 29 | {{else}} | ||
| 30 | <a href="{{$old.Src}}"><img src="{{$old.Src}}" alt="{{$file.Label}} before" loading="lazy" decoding="async"></a> | ||
| 31 | {{end}} | ||
| 32 | <figcaption class="muted">before</figcaption> | ||
| 33 | </figure> | ||
| 34 | {{end}} | ||
| 35 | {{if $new.Src}} | ||
| 36 | <figure> | ||
| 37 | {{if $new.Model}} | ||
| 38 | <div class="model-viewer" data-model="{{$new.Src}}" data-format="{{$new.Format}}" data-title="{{$file.Label}} after"> | ||
| 39 | <p class="model-fallback"><a href="{{$new.Src}}">Download</a> the after model to open it in a 3D application.</p> | ||
| 40 | </div> | ||
| 41 | {{else}} | ||
| 42 | <a href="{{$new.Src}}"><img src="{{$new.Src}}" alt="{{$file.Label}} after" loading="lazy" decoding="async"></a> | ||
| 43 | {{end}} | ||
| 44 | <figcaption class="muted">after</figcaption> | ||
| 45 | </figure> | ||
| 46 | {{end}} | ||
| 47 | </div> | ||
| 18 | 48 | {{end}} | |
| 49 | {{if .Binary}}{{if not (or $old.Src $new.Src)}} | ||
| 50 | <p class="binary">Binary file: no line diff to show. Use <code>git show</code> to inspect it.</p> | ||
| 51 | {{end}}{{end}} | ||
| 19 | 52 | {{if .Hunks}} | |
| 20 | 53 | <table> | |
| 21 | 54 | <colgroup><col class="comment-col"><col class="ln-col"><col class="ln-col"><col></colgroup> | |