feat: add multiavatar-based SVG avatar endpoint and integrate into message template

Add a new `/avatar/{uid}.svg` route served by `AvatarView` that generates deterministic SVG avatars using the `multiavatar` library keyed on user UID. Register the view in the application router and update `message.html` to replace the plain initial-letter avatar with an `<img>` tag pointing to the new endpoint. Also add `multiavatar` to project dependencies in `pyproject.toml`, introduce `python` and `run` convenience targets in the Makefile, and set aggressive `Cache-Control` headers on both the avatar and upload responses to reduce server load.
This commit is contained in:
2025-02-25 23:22:36 +00:00
parent d011dc2897
commit 3639bfb086
6 changed files with 53 additions and 6 deletions
+5 -3
View File
@@ -5,13 +5,15 @@ GUNICORN=./.venv/bin/gunicorn
GUNICORN_WORKERS = 1
PORT = 8081
python:
$(PYTHON)
run:
$(GUNICORN) -w $(GUNICORN_WORKERS) -k aiohttp.worker.GunicornWebWorker snek.gunicorn:app --bind 0.0.0.0:$(PORT) --reload
install:
python3 -m venv .venv
$(PIP) install -e .
run:
$(GUNICORN) -w $(GUNICORN_WORKERS) -k aiohttp.worker.GunicornWebWorker snek.gunicorn:app --bind 0.0.0.0:$(PORT) --reload