forked from retoor/snek
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user