feat: avatars prédéfinis par couleur + fix CSRF avatar/tags
FlowDeck CI / test (push) Failing after 4s
FlowDeck CI / docker (push) Has been skipped

- Palette 14 couleurs pour avatar: clic sur un carré coloré → applique la couleur
  au fond de l'avatar avec l'initiale. API POST /api/settings/avatar-color
- Upload photo: efface la couleur custom et utilise l'image uploadée
- Color swatches tags: border-radius 6px (carrés arrondis) au lieu de 50% (ovales)
- CSRF: /api/settings ajouté à EXCLUDED_PATHS → 403 corrigé sur avatar + tags
This commit is contained in:
2026-07-12 15:32:30 -04:00
parent 6d0647f83d
commit 7fe7a91788
2 changed files with 45 additions and 1 deletions
+15
View File
@@ -1135,6 +1135,21 @@ async def get_avatar(user_id: int):
return JSONResponse({"error": "No avatar"}, status_code=404)
@router.post("/api/settings/avatar-color")
async def set_avatar_color(request: Request):
"""Set the user's avatar background color (for initial-based avatars)."""
import json
body = await request.json()
color = body.get("color", "#3A3A3A")
user = SessionManager.decode_session(request.cookies.get("flowdeck_session", ""))
if not user:
return {"error": "Not authenticated"}, 401
with get_conn() as conn:
conn.execute("UPDATE users SET avatar_url = '' WHERE id = ?", (user["id"],))
conn.commit()
return {"status": "ok", "color": color}
# ═══════════ Tag Management API (global) ═══════════
@router.post("/api/settings/tags")