mirror of
https://github.com/revanced/revanced-polling-api.git
synced 2025-04-29 22:24:26 +02:00
Merge branch 'dev'
This commit is contained in:
commit
7c46b4589e
@ -38,4 +38,4 @@ class BallotCastedResponse(BaseModel):
|
||||
BaseModel (pydantic.BaseModel): BaseModel from pydantic
|
||||
"""
|
||||
|
||||
casted: bool
|
||||
cast: bool
|
||||
|
@ -39,7 +39,7 @@ async def auth(request: Request, response: Response, client: ClientModels.Client
|
||||
}
|
||||
)
|
||||
else:
|
||||
if not ballot.exists(client.discord_id_hash):
|
||||
if not await ballot.exists(client.discord_id_hash):
|
||||
user_claims: dict[str, str] = {}
|
||||
user_claims['discord_id_hash'] = client.discord_id_hash
|
||||
access_token = Authorize.create_access_token(subject=client.id,
|
||||
@ -75,7 +75,7 @@ async def exchange_token(request: Request, response: Response, Authorize: AuthPA
|
||||
access_token = Authorize.create_access_token(subject=Authorize.get_subject(),
|
||||
user_claims=user_claims,
|
||||
fresh=True)
|
||||
if not ballot.exists(Authorize.get_subject()):
|
||||
if not await ballot.exists(Authorize.get_subject()):
|
||||
if await clients.ban_token(Authorize.get_jti()):
|
||||
return {"access_token": access_token}
|
||||
else:
|
||||
|
@ -41,7 +41,7 @@ async def cast_ballot(request: Request, response: Response,
|
||||
|
||||
if stored:
|
||||
await client.ban_token(Authorize.get_jti())
|
||||
return {"created": stored}
|
||||
return {"cast": stored}
|
||||
else:
|
||||
raise HTTPException(status_code=500, detail={
|
||||
"error": GeneralErrors.InternalServerError().error,
|
||||
|
Loading…
x
Reference in New Issue
Block a user