mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-29 03:02:11 +01:00
commit
56e74f28be
@ -25,9 +25,9 @@ async def wait_for_paid_invoices():
|
||||
await on_invoice_paid(payment)
|
||||
|
||||
|
||||
async def on_invoice_paid(payment: Payment) -> None:
|
||||
async def on_invoice_paid(payment: Payment):
|
||||
# (avoid loops)
|
||||
if payment.extra.get("tag") == "scrubed":
|
||||
if payment.extra and payment.extra.get("tag") == "scrubed":
|
||||
# already scrubbed
|
||||
return
|
||||
|
||||
@ -53,7 +53,7 @@ async def on_invoice_paid(payment: Payment) -> None:
|
||||
timeout=40,
|
||||
)
|
||||
if r.is_error:
|
||||
raise httpx.ConnectError
|
||||
raise httpx.ConnectError("issue with scrub callback")
|
||||
except (httpx.ConnectError, httpx.RequestError):
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
|
@ -1,5 +1,4 @@
|
||||
from fastapi import Request
|
||||
from fastapi.params import Depends
|
||||
from fastapi import Depends, Request
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from starlette.responses import HTMLResponse
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
from http import HTTPStatus
|
||||
|
||||
from fastapi import Request
|
||||
from fastapi.param_functions import Query
|
||||
from fastapi.params import Depends
|
||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
||||
from fastapi import Depends, Query
|
||||
from starlette.exceptions import HTTPException
|
||||
|
||||
from lnbits.core.crud import get_user
|
||||
@ -23,14 +20,14 @@ from .models import CreateScrubLink
|
||||
|
||||
@scrub_ext.get("/api/v1/links", status_code=HTTPStatus.OK)
|
||||
async def api_links(
|
||||
req: Request,
|
||||
wallet: WalletTypeInfo = Depends(get_key_type),
|
||||
all_wallets: bool = Query(False),
|
||||
):
|
||||
wallet_ids = [wallet.wallet.id]
|
||||
|
||||
if all_wallets:
|
||||
wallet_ids = (await get_user(wallet.wallet.user)).wallet_ids
|
||||
user = await get_user(wallet.wallet.user)
|
||||
wallet_ids = user.wallet_ids if user else []
|
||||
|
||||
try:
|
||||
return [link.dict() for link in await get_scrub_links(wallet_ids)]
|
||||
@ -43,9 +40,7 @@ async def api_links(
|
||||
|
||||
|
||||
@scrub_ext.get("/api/v1/links/{link_id}", status_code=HTTPStatus.OK)
|
||||
async def api_link_retrieve(
|
||||
r: Request, link_id, wallet: WalletTypeInfo = Depends(get_key_type)
|
||||
):
|
||||
async def api_link_retrieve(link_id, wallet: WalletTypeInfo = Depends(get_key_type)):
|
||||
link = await get_scrub_link(link_id)
|
||||
|
||||
if not link:
|
||||
|
@ -104,7 +104,6 @@ exclude = """(?x)(
|
||||
| ^lnbits/extensions/offlineshop.
|
||||
| ^lnbits/extensions/paywall.
|
||||
| ^lnbits/extensions/satspay.
|
||||
| ^lnbits/extensions/scrub.
|
||||
| ^lnbits/extensions/splitpayments.
|
||||
| ^lnbits/extensions/streamalerts.
|
||||
| ^lnbits/extensions/tpos.
|
||||
|
Loading…
x
Reference in New Issue
Block a user