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/request_view.go +15

@@ -678,6 +678,21 @@ type reviewChange struct {
678 678 Merged bool
679 679 }
680 680
681 // sides names the two commits a changed file's bytes can be read at. From is a
682 // range while the request is open and a commit once it has landed, so the range
683 // is resolved to its merge base; that is the commit the patch's old side is.
684 func (c reviewChange) sides(g *git.Repo) (oldRef, newRef string) {
685 if c.To != "" {
686 return c.From, c.To
687 }
688 if base, head, ok := strings.Cut(c.From, "..."); ok {
689 if mb, err := g.MergeBase(base, head); err == nil {
690 return mb, head
691 }
692 }
693 return "", ""
694 }
695
681 696 // reviewDiff lists what a change request changes and says whether it has already
682 697 // been merged, which is what the changed-file tree, the line counts and the
683 698 // landing summary read.