fix: request headers
parent
381aa0057e
commit
01ef0b8c4f
4
main.py
4
main.py
|
|
@ -50,11 +50,11 @@ async def main():
|
||||||
message_send_instance.maibot_router = router
|
message_send_instance.maibot_router = router
|
||||||
_ = await asyncio.gather(napcat_server(), mmc_start_com(), message_process(), check_timeout_response())
|
_ = await asyncio.gather(napcat_server(), mmc_start_com(), message_process(), check_timeout_response())
|
||||||
|
|
||||||
def check_napcat_server_token(path, request_headers):
|
def check_napcat_server_token(path, request):
|
||||||
token = global_config.napcat_server.token
|
token = global_config.napcat_server.token
|
||||||
if not token or token.strip() == "":
|
if not token or token.strip() == "":
|
||||||
return
|
return
|
||||||
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 http.HTTPStatus.UNAUTHORIZED, [], b"Unauthorized\n"
|
return http.HTTPStatus.UNAUTHORIZED, [], b"Unauthorized\n"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue