fix/token header

This commit is contained in:
SouthFox 2023-04-02 15:48:17 +08:00
parent d56251ceb9
commit 60fd0dc092

View file

@ -75,17 +75,18 @@ async def outbox(
db_session: AsyncSession = Depends(get_db_session), db_session: AsyncSession = Depends(get_db_session),
) -> Response: ) -> Response:
payload = await request.body() payload = await request.body()
logger.info(payload) content = payload.decode("utf-8")
logger.info(content)
post_token = request.headers.get("Authorization")
if POST_TOKEN is not None \ if POST_TOKEN is not None \
and POST_TOKEN == request.headers.get("post_token"): and POST_TOKEN == post_token.split(" ")[1]: # type: ignore
logger.info("True token") logger.info("True token")
from app.activitypub import VisibilityEnum from app.activitypub import VisibilityEnum
from app.boxes import _send_create from app.boxes import _send_create
from app.orgpython import to_html from app.orgpython import to_html
content = payload.decode("utf-8")
content = to_html(content).replace("\n", "") content = to_html(content).replace("\n", "")
await _send_create( await _send_create(