MCPcopy
hub / github.com/AstrBotDevs/AstrBot / _extract_dashboard_jwt

Method _extract_dashboard_jwt

astrbot/dashboard/server.py:416–429  ·  view source on GitHub ↗
(current_request: Request)

Source from the content-addressed store, hash-verified

414
415 @staticmethod
416 def _extract_dashboard_jwt(current_request: Request) -> str | None:
417 auth_header = current_request.headers.get("Authorization", "").strip()
418 if auth_header.startswith("Bearer "):
419 token = auth_header.removeprefix("Bearer ").strip()
420 if token:
421 return token
422
423 cookie_token = current_request.cookies.get(
424 DASHBOARD_JWT_COOKIE_NAME,
425 "",
426 ).strip()
427 if cookie_token:
428 return cookie_token
429 return None
430
431 def check_port_in_use(self, port: int) -> bool:
432 """跨平台检测端口是否被占用"""

Callers 1

auth_middlewareMethod · 0.95

Calls 2

startswithMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected