vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0: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/instance_repo.go +35
| @@ -0,0 +1,35 @@ | |||
| 1 | package server | ||
| 2 | |||
| 3 | // The instance repository is reloaded on a short timer, the same trade the pages | ||
| 4 | // server makes for a site tip: a push is live within a couple of seconds, and a | ||
| 5 | // request never runs git. A load error keeps the previous snapshot; the warning | ||
| 6 | // is repeated only when the error changes, so a missing repository does not fill | ||
| 7 | // the log. | ||
| 8 | |||
| 9 | import ( | ||
| 10 | "context" | ||
| 11 | "time" | ||
| 12 | ) | ||
| 13 | |||
| 14 | const instanceRepoReload = 2 * time.Second | ||
| 15 | |||
| 16 | func (s *Server) watchInstanceRepo(ctx context.Context) { | ||
| 17 | t := time.NewTicker(instanceRepoReload) | ||
| 18 | defer t.Stop() | ||
| 19 | last := "" | ||
| 20 | for { | ||
| 21 | select { | ||
| 22 | case <-ctx.Done(): | ||
| 23 | return | ||
| 24 | case <-t.C: | ||
| 25 | err := s.InstanceRepo.Reload() | ||
| 26 | switch { | ||
| 27 | case err == nil: | ||
| 28 | last = "" | ||
| 29 | case err.Error() != last: | ||
| 30 | s.Log.Warn("instance repository: cannot load", "repo", s.Cfg.InstanceRepo, "err", err) | ||
| 31 | last = err.Error() | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||