# forgejo-stlview Interactive 3D previews for `.stl` files in [Forgejo](https://forgejo.org/), with no patches to Forgejo itself. Written up here: **[Adding STL 3D Previews to Forgejo](https://fmartingr.com/blog/2026/03/15/adding-stl-3d-previews-to-forgejo/)** ## Contents ``` custom/templates/custom/header.tmpl injects the .stl-page class + loading placeholder custom/templates/custom/footer.tmpl loads the viewer as an ES module custom/public/assets/stlview.js the viewer custom/public/assets/three.js/ pinned three.js r160 (three modules only) docker-compose.example.yml markup config + volume mounts ``` Mount `custom/templates` and `custom/public` into the container and set the `markup.stl` environment variables — see `docker-compose.example.yml`. ## Notes `three.js/examples/jsm/loaders/STLLoader.js` and `three.js/examples/jsm/controls/TrackballControls.js` are **patched**. Stock r160 imports three via the bare specifier `'three'`, which a browser cannot resolve without an import map; both files here point at `../../../build/three.module.min.js` instead. That is the only change, and `build/three.module.min.js` is byte-identical to the r160 release. ## Licensing `stlview.js` is derived from [Codeberg's `stlview.js`](https://codeberg.org/Codeberg-Infrastructure/build-deploy-forgejo/src/branch/codeberg-8/etc/gitea/public/assets/stlview.js), which is AGPL-3.0. `LICENSE` therefore applies to the viewer and templates. Vendored three.js under `custom/public/assets/three.js/` is MIT — see `custom/public/assets/three.js/LICENSE`.