Files
endurain/backend/app/core/utils.py
João Vitória Silva c3431fc8bc Update session handling and error responses for login
Backend endpoints now return session_id in a JSON object for web clients, improving consistency. Frontend logic updated to handle new session_id format and store it properly. Error handling for missing frontend resources improved with 404 responses. Minor cleanup in frontend login view and session management.
2025-10-06 15:20:02 +01:00

34 lines
878 B
Python

import os
from fastapi.responses import FileResponse
import core.config as core_config
def return_frontend_index(path: str):
file_path = f"{core_config.FRONTEND_DIR}/" + path
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)
def return_user_img_path(user_img: str):
file_path = f"{core_config.USER_IMAGES_DIR}/" + user_img
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)
def return_server_img_path(server_img: str):
file_path = f"{core_config.SERVER_IMAGES_DIR}/" + server_img
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)
def return_activity_media_path(media: str):
file_path = f"{core_config.ACTIVITY_MEDIA_DIR}/" + media
if not os.path.isfile(file_path):
return None
return FileResponse(file_path)