[refactor] format code & rename var

This commit is contained in:
SouthFox 2023-08-01 22:25:02 +08:00
parent 600d8d2032
commit 652db0ca20

View file

@ -83,10 +83,12 @@ async def index(
statues = (
await db_session.scalars(
select(models.OutboxObject).where(
select(models.OutboxObject)
.where(
models.OutboxObject.ap_type == "Note",
models.OutboxObject.is_deleted.is_(False),
).order_by(models.OutboxObject.created_at.desc())
)
.order_by(models.OutboxObject.created_at.desc())
)
).all()
@ -95,7 +97,7 @@ async def index(
{
"request": request,
"statues": statues,
}
},
)
@ -109,16 +111,10 @@ async def inbox(
payload = await request.json()
if not httpsig_checker:
return Response(
status_code=406,
content="invalid http-sig"
)
return Response(status_code=406, content="invalid http-sig")
if not await save_incoming(db_session, payload):
return Response(
status_code=406,
content="invalid activitypub object"
)
return Response(status_code=406, content="invalid activitypub object")
return Response(status_code=202)
@ -185,7 +181,7 @@ async def wellknown_webfinger(resource: str) -> JSONResponse:
logger.info(f"Got invalid req for {resource}")
raise HTTPException(status_code=404)
out = {
response = {
"subject": f"acct:{USERNAME}@{DOMAIN}",
"aliases": [ID],
"links": [
@ -203,7 +199,7 @@ async def wellknown_webfinger(resource: str) -> JSONResponse:
}
return JSONResponse(
out,
response,
media_type="application/jrd+json; charset=utf-8",
headers={"Access-Control-Allow-Origin": "*"},
)