Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

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/commit.go +8−1

@@ -85,17 +85,24 @@ func (w *Web) CommitView(rw http.ResponseWriter, r *http.Request) {
85 85 w.notFound(rw, r)
86 86 return
87 87 }
88 parents, _ := g.CommitParents(sha)
88 89 main, err := commitDiff(g, sha, selected, files, chosen)
89 90 if err != nil {
90 91 w.serverError(rw, r, "cannot read that commit: "+err.Error())
91 92 return
92 93 }
94 // A picture's two sides are the parent and this commit. A root commit has no
95 // parent, so only the added side can be shown.
96 oldRef := ""
97 if len(parents) > 0 {
98 oldRef = parents[0]
99 }
100 withDiffMedia(m.Name, oldRef, sha, main.Files)
93 101 if htmxRequest(r) {
94 102 w.render(rw, "commit_main", main, 0)
95 103 return
96 104 }
97 105 body, _ := g.CommitBody(sha)
98 parents, _ := g.CommitParents(sha)
99 106 w.render(rw, "commit", commitView{
100 107 Page: w.page(r, m.Name+" · "+log[0].Subject),
101 108 Name: m.Name,