refactor: clean up whitespace and improve readability in logging middleware

This commit is contained in:
shiyu
2025-09-10 10:58:42 +08:00
parent 2b8cfce8f2
commit f484557874
+8 -1
View File
@@ -5,11 +5,18 @@ from services.logging import LogService
from models.database import UserAccount
import jwt
from jwt.exceptions import InvalidTokenError
from services.auth import ALGORITHM
from services.auth import ALGORITHM
from services.config import ConfigCenter
class LoggingMiddleware(BaseHTTPMiddleware):
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()
user_id = None
if "authorization" in request.headers: