feat: add frontend views and file management functionality, enhance user response structure, and update configuration guide

This commit is contained in:
Christian Krakau-Louis
2025-04-03 21:49:15 +02:00
parent 2cafda11dd
commit d23a48b1c0
19 changed files with 892 additions and 1406 deletions
+15 -6
View File
@@ -10,8 +10,7 @@ logger = logging.getLogger(__name__)
router = APIRouter()
@router.get("/whoami")
async def whoami(request: Request):
async def whoami_handler(request: Request):
"""
Returns user info if logged in, else 401.
"""
@@ -26,8 +25,18 @@ async def whoami(request: Request):
# Generate Gravatar URL from email
email_hash = md5(email.strip().lower().encode()).hexdigest()
gravatar_url = f"https://www.gravatar.com/avatar/{email_hash}?d=identicon"
# Add the gravatar URL to the user object instead of creating a new response
user_response = user.copy() # Create a copy to avoid modifying the session
user_response["picture"] = gravatar_url
return user_response
return {
"email": email,
"picture": gravatar_url
}
# Register the same handler under two different paths
@router.get("/whoami")
async def whoami(request: Request):
return await whoami_handler(request)
@router.get("/auth/whoami")
async def auth_whoami(request: Request):
return await whoami_handler(request)