mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-07 08:36:49 +08:00
refactor: clean up whitespace and improve readability in logging middleware
This commit is contained in:
@@ -8,8 +8,15 @@ from jwt.exceptions import InvalidTokenError
|
|||||||
from services.auth import ALGORITHM
|
from services.auth import ALGORITHM
|
||||||
from services.config import ConfigCenter
|
from services.config import ConfigCenter
|
||||||
|
|
||||||
|
|
||||||
class LoggingMiddleware(BaseHTTPMiddleware):
|
class LoggingMiddleware(BaseHTTPMiddleware):
|
||||||
async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response:
|
async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response:
|
||||||
|
path = request.url.path
|
||||||
|
method = request.method.upper()
|
||||||
|
if method == "GET":
|
||||||
|
if path == "/api/logs" or path == "/api/plugins" or path.startswith("/api/config"):
|
||||||
|
return await call_next(request)
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
user_id = None
|
user_id = None
|
||||||
if "authorization" in request.headers:
|
if "authorization" in request.headers:
|
||||||
|
|||||||
Reference in New Issue
Block a user