Fix public routes path

This commit is contained in:
Iam54r1n4
2025-02-05 22:33:29 +00:00
parent cd69795c5e
commit 16e832f46f

View File

@ -6,6 +6,7 @@ from typing import Awaitable, Callable
from datetime import datetime, timezone from datetime import datetime, timezone
from session import SessionManager from session import SessionManager
from config import CONFIGS
class AuthMiddleware(BaseHTTPMiddleware): class AuthMiddleware(BaseHTTPMiddleware):
@ -19,8 +20,8 @@ class AuthMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request: Request, call_next: Callable[[Request], Awaitable[Response]]): async def dispatch(self, request: Request, call_next: Callable[[Request], Awaitable[Response]]):
'''Handles session authentication.''' '''Handles session authentication.'''
public_routes = [ public_routes = [
'/login', f'/{CONFIGS.ROOT_PATH}/login',
'/robots.txt' f'/{CONFIGS.ROOT_PATH}/robots.txt'
] ]
if request.url.path in public_routes: if request.url.path in public_routes:
return await call_next(request) return await call_next(request)