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/templates/status.html +34

@@ -175,6 +175,40 @@ with <code>vole runner --remote ssh://git@&lt;host&gt;</code>. If a job asks for
175 175 {{end}}
176 176
177 177 {{if eq .Tab "configuration"}}
178 <h2 id="instance-repository">Instance repository</h2>
179 {{if .InstanceRepo.Created}}<div class="flash good">Instance repository created. The home page now reads <code>profile/README.md</code> from it.</div>{{end}}
180 {{if not .InstanceRepo.Enabled}}
181 <p class="muted">Customization from a repository is disabled because <code>instance_repo</code> is empty.</p>
182 {{else if .InstanceRepo.Ready}}
183 {{if .InstanceRepo.Err}}<div class="flash warn">The last reload failed; the previous theme is still in use: {{.InstanceRepo.Err}}</div>{{end}}
184 <p class="muted">Loaded from <code>{{.InstanceRepo.Name}}</code> at <code>{{short .InstanceRepo.Commit}}</code>.
185 Clone it with <code>{{.InstanceRepo.CloneURL}}</code>.</p>
186 {{else}}
187 {{if .InstanceRepo.Err}}
188 <p class="muted">The instance repository <code>{{.InstanceRepo.Name}}</code> is not readable: {{.InstanceRepo.Err}}</p>
189 {{else}}
190 <p class="muted">The instance repository <code>{{.InstanceRepo.Name}}</code> does not exist yet.</p>
191 {{end}}
192 <form method="post" action="/admin/instance/repo" class="form-block">
193 <input type="hidden" name="csrf" value="{{.CSRF}}">
194 <div class="form-actions"><button type="submit">{{icon "plus"}}Create instance repository</button></div>
195 </form>
196 <p class="muted">Or create a repository named <code>{{.InstanceRepo.Name}}</code> and push the files below.</p>
197 {{end}}
198 <div class="panel">
199 <table class="config-table">
200 <thead><tr><th>Path</th><th>What it does</th></tr></thead>
201 <tbody>
202 <tr><td><code>profile/README.md</code></td><td>Landing page introduction (markdown, sanitized)</td></tr>
203 <tr><td><code>profile/private/README.md</code></td><td>The same, only for signed-in viewers</td></tr>
204 <tr><td><code>profile/custom.css</code></td><td>Stylesheet loaded after the built-in ones</td></tr>
205 <tr><td><code>profile/favicon.svg</code></td><td>Favicon override</td></tr>
206 <tr><td><code>assets/</code></td><td>Files served at <code>/static/custom/assets/</code></td></tr>
207 </tbody>
208 </table>
209 </div>
210 <p class="muted">The repository is private to instance admins, but these files are served to visitors.
211 Other files are ignored.</p>
178 212 {{if .Config}}
179 213 <h2 id="configuration">Configuration</h2>
180 214 <p class="muted">Effective values read at startup. This page is read-only; edit the file on the host and restart Vole to apply changes.</p>