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/markdown_test.go +25
| @@ -102,6 +102,31 @@ func TestDocHrefResolvesAgainstTheDocument(t *testing.T) { | |||
| 102 | 102 | } | |
| 103 | 103 | } | |
| 104 | 104 | ||
| 105 | // The instance introduction lives in the instance repository, but the only | ||
| 106 | // files that repository serves are the assets. A relative destination that names | ||
| 107 | // one has to come out as the URL the asset route answers, or a picture in the | ||
| 108 | // landing page is a broken image. | ||
| 109 | func TestInstanceIntroResolvesAssets(t *testing.T) { | ||
| 110 | t.Parallel() | ||
| 111 | w := newTestWeb(t) | ||
| 112 | got := string(w.renderInstanceMarkdown("\n\n" + | ||
| 113 | "\n\n" + | ||
| 114 | "[style](assets/site.css?v=2#top)\n\n" + | ||
| 115 | "[readme](../README.md)\n\n" + | ||
| 116 | "\n")) | ||
| 117 | for _, want := range []string{ | ||
| 118 | `src="/-/static/custom/assets/logo.png"`, | ||
| 119 | `src="/-/static/custom/assets/dark/logo.png"`, | ||
| 120 | `href="/-/static/custom/assets/site.css?v=2#top"`, | ||
| 121 | `href="../README.md"`, | ||
| 122 | `src="https://example.com/logo.png"`, | ||
| 123 | } { | ||
| 124 | if !strings.Contains(got, want) { | ||
| 125 | t.Fatalf("intro is missing %q:\n%s", want, got) | ||
| 126 | } | ||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 105 | 130 | // A body may name an entity by its durable ULID or by its `#42` alias. Both link, | |
| 106 | 131 | // and the alias goes to the kind-agnostic route because only the server can say | |
| 107 | 132 | // whether a number names an issue or a change request. | |