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/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/web/status.go +6−5

@@ -92,7 +92,7 @@ func (w *Web) StatusRedirect(rw http.ResponseWriter, r *http.Request) {
92 92 // fillStatusView reads the instance state the status tabs show. It is a method on
93 93 // the Admin view because those tabs are sections of that page, not a page of
94 94 // their own; each branch reads only what its tab renders.
95 func (w *Web) fillStatusView(view *adminPageView) {
95 func (w *Web) fillStatusView(r *http.Request, view *adminPageView) {
96 96 tab := view.Tab
97 97 if tab == "overview" {
98 98 if w.Ident != nil {
@@ -148,6 +148,7 @@ func (w *Web) fillStatusView(view *adminPageView) {
148 148 // never edited here.
149 149 if tab == "configuration" && w.Cfg != nil {
150 150 view.Config = w.statusConfig()
151 view.InstanceRepo = w.instanceRepoView(r)
151 152 }
152 153 }
153 154
@@ -259,9 +260,9 @@ func (w *Web) statusConfig() *statusConfigView {
259 260 if strings.TrimSpace(cfg.InstanceName) == "" {
260 261 instanceNameNote = "default: Vole"
261 262 }
262 instanceTaglineNote := ""
263 if strings.TrimSpace(cfg.InstanceTagline) == "" {
264 instanceTaglineNote = "built-in tagline"
263 instanceRepoNote := ""
264 if strings.TrimSpace(cfg.InstanceRepo) == "" {
265 instanceRepoNote = "customization disabled"
265 266 }
266 267
267 268 devOnly := statusSetting{Key: "dev_only", Value: yesNo(cfg.DevOnly)}
@@ -340,7 +341,7 @@ func (w *Web) statusConfig() *statusConfigView {
340 341 v.Groups = []statusSettingGroup{
341 342 {Name: "Instance and access", Settings: []statusSetting{
342 343 configSetting("instance_name", cfg.InstanceName, instanceNameNote),
343 configSetting("instance_tagline", cfg.InstanceTagline, instanceTaglineNote),
344 configSetting("instance_repo", cfg.InstanceRepo, instanceRepoNote),
344 345 configSetting("public_url", cfg.PublicURL, publicNote),
345 346 configSetting("open_registration", yesNo(cfg.OpenRegistration), registrationNote),
346 347 configSetting("open_registration_role", cfg.OpenRegistrationRole, ""),