mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 12:32:34 +02:00
fixed satdice
This commit is contained in:
@@ -31,4 +31,4 @@ from .views_api import * # noqa
|
|||||||
|
|
||||||
def copilot_start():
|
def copilot_start():
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|
loop.create_task(catch_everything_and_restart(wait_for_paid_invoices))
|
@@ -139,7 +139,7 @@ async def api_lnurlw_response(req: Request, unique_hash: str = Query(None)):
|
|||||||
|
|
||||||
@satsdice_ext.get(
|
@satsdice_ext.get(
|
||||||
"/api/v1/lnurlw/cb/{unique_hash}",
|
"/api/v1/lnurlw/cb/{unique_hash}",
|
||||||
response_class=HTMLResponse,
|
status_code=HTTPStatus.OK,
|
||||||
name="satsdice.api_lnurlw_callback",
|
name="satsdice.api_lnurlw_callback",
|
||||||
)
|
)
|
||||||
async def api_lnurlw_callback(
|
async def api_lnurlw_callback(
|
||||||
@@ -158,7 +158,6 @@ async def api_lnurlw_callback(
|
|||||||
paylink = await get_satsdice_pay(link.satsdice_pay)
|
paylink = await get_satsdice_pay(link.satsdice_pay)
|
||||||
|
|
||||||
await update_satsdice_withdraw(link.id, used=1)
|
await update_satsdice_withdraw(link.id, used=1)
|
||||||
print("cunt")
|
|
||||||
await pay_invoice(
|
await pay_invoice(
|
||||||
wallet_id=paylink.wallet,
|
wallet_id=paylink.wallet,
|
||||||
payment_request=pr,
|
payment_request=pr,
|
||||||
|
@@ -45,8 +45,8 @@ async def display(request: Request, link_id: str = Query(None)):
|
|||||||
link = await get_satsdice_pay(link_id)
|
link = await get_satsdice_pay(link_id)
|
||||||
if not link:
|
if not link:
|
||||||
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."
|
||||||
)
|
)
|
||||||
|
|
||||||
return satsdice_renderer().TemplateResponse(
|
return satsdice_renderer().TemplateResponse(
|
||||||
"satsdice/display.html",
|
"satsdice/display.html",
|
||||||
@@ -60,7 +60,11 @@ async def display(request: Request, link_id: str = Query(None)):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@satsdice_ext.get("/win/{link_id}/{payment_hash}", name="satsdice.displaywin", response_class=HTMLResponse)
|
@satsdice_ext.get(
|
||||||
|
"/win/{link_id}/{payment_hash}",
|
||||||
|
name="satsdice.displaywin",
|
||||||
|
response_class=HTMLResponse,
|
||||||
|
)
|
||||||
async def displaywin(
|
async def displaywin(
|
||||||
request: Request, link_id: str = Query(None), payment_hash: str = Query(None)
|
request: Request, link_id: str = Query(None), payment_hash: str = Query(None)
|
||||||
):
|
):
|
||||||
@@ -86,9 +90,6 @@ async def displaywin(
|
|||||||
)
|
)
|
||||||
rand = random.randint(0, 100)
|
rand = random.randint(0, 100)
|
||||||
chance = satsdicelink.chance
|
chance = satsdicelink.chance
|
||||||
print(rand)
|
|
||||||
print(chance)
|
|
||||||
print(rand < 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"]:
|
||||||
return satsdice_renderer().TemplateResponse(
|
return satsdice_renderer().TemplateResponse(
|
||||||
|
Reference in New Issue
Block a user