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/auth.go +4−2

@@ -364,9 +364,11 @@ func (w *Web) securityHeaders(rw http.ResponseWriter, r *http.Request) {
364 364 // There is no inline style in any template and none is generated, so the
365 365 // stylesheet is the only style source. object-src is closed because nothing here
366 366 // embeds a plugin, and a page that never loads one cannot be made to. The
367 // syntax highlighter runs in a worker of its own, hence worker-src.
367 // syntax highlighter runs in a worker of its own, hence worker-src. A GLTF or
368 // 3MF texture is decoded from a blob the model viewer creates, so image and
369 // connection fetches allow blob: as well as this origin and data URIs.
368 370 rw.Header().Set("Content-Security-Policy",
369 "default-src 'self'; script-src 'self'; worker-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'none'; object-src 'none'")
371 "default-src 'self'; script-src 'self'; worker-src 'self'; style-src 'self'; img-src 'self' data: blob:; connect-src 'self' blob:; form-action 'self'; frame-ancestors 'none'; base-uri 'none'; object-src 'none'")
370 372 // Nothing on this page needs a device, a payment API or an interest cohort, and
371 373 // the site runs beside its own pages on a pages subdomain: COOP/CORP keep a
372 374 // document from being opened or read as somebody else's resource.