Sign in

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

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Customize the instance from an instance repository

6ce635a84ad5d5d0c862d4deb4d46489dc97c677 · Keenan Nemetz · 1d ago · parent f2fd4024

Customize the instance from an instance repository

The landing page's prose was config-only, so changing it meant editing
vole.toml on the host and restarting, and the packaged service cannot write
that file. Custom CSS, assets, and a favicon had nowhere to live at all.

This adds an instance repository, modelled on GitHub's .github repository:
fixed paths in one private repository, read as data rather than executed.

    profile/README.md           the landing page introduction
    profile/private/README.md   replaces it for signed-in viewers
    profile/custom.css          loaded after the built-in stylesheets
    profile/favicon.svg         favicon override
    assets/                     served at /static/custom/assets/

forge/instancerepo reads one commit into an immutable snapshot on a two
second timer and swaps it atomically; a request never runs git, and a load
failure keeps the previous theme. Markdown goes through the issue sanitiser,
assets are an extension whitelist with size and count caps, and scripts and
HTML are not assets. The repository is private to instance admins and hidden
from the home grid and activity rail, but its files are served to visitors.

The Admin Configuration tab grows an Instance repository panel: status, the
last commit, the last load error, the clone URL, the recognized paths, and a
button that creates the repository with starter files. The home page's pencil
keeps the in-place editor, but a save is now a commit to profile/README.md
with the admin as the author and web.home.intro in the audit log, instead of a
row in users.db.

The rest of the landing page stays in the shape it had: instance_name as the
heading, the introduction card, then the repository grid beside the Latest
rail. Moving a configurable page layout into a template system was tried and
dropped: this is fixed files, not a templating surface.

This replaces the pending introduction-store change, which is closed.

server/routes.go +5−3

@@ -12,8 +12,6 @@ package server
12 12 import (
13 13 "fmt"
14 14 "net/http"
15
16 "github.com/rodent-software/vole/server/web"
17 15 )
18 16
19 17 // routes builds the forge's HTTP surface. The catch-all is registered last for
@@ -34,7 +32,7 @@ func (s *Server) routes() *http.ServeMux {
34 32 // assetRoutes serves the embedded stylesheet, scripts, and favicon. Assets are
35 33 // compiled into the binary, so there is no directory to deploy beside it.
36 34 func (s *Server) assetRoutes(mux *http.ServeMux) {
37 mux.Handle("GET /static/", web.Static())
35 mux.Handle("GET /static/", s.Web.Static())
38 36 }
39 37
40 38 // globalRoutes are the destinations that are not scoped to a repository:
@@ -43,6 +41,9 @@ func (s *Server) assetRoutes(mux *http.ServeMux) {
43 41 func (s *Server) globalRoutes(mux *http.ServeMux) {
44 42 w := s.Web
45 43 mux.HandleFunc("GET /{$}", w.IndexPage)
44 // The introduction card edits in place on the home page; the save is an
45 // instance-admin form and lands back on the page it changed.
46 mux.HandleFunc("POST /{$}", w.SaveHomeIntro)
46 47 mux.HandleFunc("GET /activity", w.InstanceActivity)
47 48 // Accounts are public on this instance: the directory lists everybody, and a
48 49 // profile answers for any name in it. Their activity is not public — every
@@ -98,6 +99,7 @@ func (s *Server) authRoutes(mux *http.ServeMux) {
98 99 func (s *Server) adminRoutes(mux *http.ServeMux) {
99 100 w := s.Web
100 101 mux.HandleFunc("GET /admin", w.AdminPage)
102 mux.HandleFunc("POST /admin/instance/repo", w.CreateInstanceRepo)
101 103 mux.HandleFunc("GET /repos/new", w.AdminNewRepoPage)
102 104 mux.HandleFunc("POST /repos", w.CreateAdminRepo)
103 105 // The roster is the Accounts tab now; /users stays as the URL the account