Merge pull request #419 from arcbtc/FastAPI

Posgres support
This commit is contained in:
Arc 2021-11-15 20:53:40 -06:00 committed by GitHub
commit 5ccf5111a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,6 +73,11 @@ async def displaywin(
raise HTTPException( raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="satsdice link does not exist." status_code=HTTPStatus.NOT_FOUND, detail="satsdice link does not exist."
) )
if satsdiceLink.lost:
return satsdice_renderer().TemplateResponse(
"satsdice/error.html",
{"request": request, "link": satsdicelink.id, "paid": False, "lost": True},
)
withdrawLink = await get_satsdice_withdraw(payment_hash) withdrawLink = await get_satsdice_withdraw(payment_hash)
if withdrawLink: if withdrawLink:
@ -92,6 +97,7 @@ async def displaywin(
chance = satsdicelink.chance chance = satsdicelink.chance
status = await api_payment(payment_hash) status = await api_payment(payment_hash)
if not rand < chance or not status["paid"]: if not rand < chance or not status["paid"]:
await update_satsdice_payment(payment_hash, lost=1)
return satsdice_renderer().TemplateResponse( return satsdice_renderer().TemplateResponse(
"satsdice/error.html", "satsdice/error.html",
{"request": request, "link": satsdicelink.id, "paid": False, "lost": True}, {"request": request, "link": satsdicelink.id, "paid": False, "lost": True},