Update main.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pull/58/head
UnCLAS-Prommer 2025-09-13 13:42:44 +08:00 committed by GitHub
parent f165cf3e2e
commit 8ac7d02362
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -56,7 +56,11 @@ def check_napcat_server_token(conn, request):
return None return None
auth_header = request.headers.get("Authorization") auth_header = request.headers.get("Authorization")
if auth_header != f"Bearer {token}": if auth_header != f"Bearer {token}":
return Server.Response(http.HTTPStatus.UNAUTHORIZED, "", headers=Server.Headers([("Content-Type", "text/plain")]), body=b"Unauthorized\n") return Server.Response(
status=http.HTTPStatus.UNAUTHORIZED,
headers=Server.Headers([("Content-Type", "text/plain")]),
body=b"Unauthorized\n"
)
return None return None
async def napcat_server(): async def napcat_server():