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.

Draw avatars with DiceBear instead of by hand

97f77001eed76cc287aeba532c4d670488121a18 · Keenan Nemetz · 7d ago · parent ca098f62

Draw avatars with DiceBear instead of by hand

The marks this package drew itself were a design I kept losing arguments
with. Avatars are now DiceBear's Shapes style, which is what the request
asked for.

DiceBear is JavaScript and Vole is a Go binary, so the split is: the
server renders the account's initial on its Everforest ground, and an
embedded bundle replaces it with the mark when the page runs. The
initial is what a browser without scripts keeps, so nothing depends on
the bundle arriving; the seed is the account name, so the same person
draws the same mark everywhere; and the ground is read from the element,
so vole.css remains the only palette.

The bundle is core 9.3.1 plus Shapes 9.4.2 (MIT code, CC0 design), built
with esbuild and committed like the other vendored scripts: 18KB, 5.5KB
gzipped. Its source is scripts/avatars-entry.js, and the licence files
beside it are inventoried in NOTICE, so the verify workflow's licence
check keeps passing. No request leaves the instance and no avatar is
stored.

Two details worth naming. Each mark gets a unique clip-mask id, because
SVG ids are document-wide and a directory page holds fifty of them. And
the RDF metadata block DiceBear embeds is stripped: it is identical for
every avatar and its licence is in NOTICE, so repeating it in the DOM
would be weight without information.

server/web/templates/chrome.html +2−1

@@ -22,6 +22,7 @@
22 22 <link rel="stylesheet" href="/static/everforest.css">
23 23 <script src="/static/htmx.min.js" defer></script>
24 24 <script src="/static/auth.js" defer></script>
25 <script src="/static/dicebear-avatars.min.js" defer></script>
25 26 <script src="/static/app.js" defer></script>
26 27 </head>
27 28 <body>
@@ -176,7 +177,7 @@
176 177 that leads to a 404. Use `who` instead where a link would be wrong: inside
177 178 another link, inside a button, in an <option>, or in an attribute. */}}
178 179 {{define "userlink"}}{{if .Known}}<a class="user" href="{{.Href}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}{{end}}
179 {{define "avatar"}}{{if .Href}}<a class="avatar c{{.Tone}}" href="{{.Href}}" tabindex="-1" aria-hidden="true">{{.SVG}}</a>{{else}}<span class="avatar c{{.Tone}}" aria-hidden="true">{{.SVG}}</span>{{end}}{{end}}
180 {{define "avatar"}}{{if .Href}}<a class="avatar c{{.Tone}}" href="{{.Href}}" tabindex="-1" aria-hidden="true" data-avatar="{{.Name}}">{{.Initial}}</a>{{else}}<span class="avatar c{{.Tone}}" aria-hidden="true" data-avatar="{{.Name}}">{{.Initial}}</span>{{end}}{{end}}
180 181
181 182 {{/* The command palette's initial state and the rows HTMX swaps in. The dialog
182 183 shell above carries both, so they live beside the chrome that owns them. */}}