htmlresponse
This commit is contained in:
parent
2a9a0bd7aa
commit
8cdbd02a77
2 changed files with 6 additions and 4 deletions
|
|
@ -5,6 +5,7 @@ from urllib.parse import urlparse
|
||||||
|
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
from lnbits import bolt11
|
from lnbits import bolt11
|
||||||
|
|
||||||
|
|
@ -13,7 +14,7 @@ from ..crud import get_standalone_payment
|
||||||
from ..tasks import api_invoice_listeners
|
from ..tasks import api_invoice_listeners
|
||||||
|
|
||||||
|
|
||||||
@core_app.get("/.well-known/lnurlp/{username}")
|
@core_app.get("/.well-known/lnurlp/{username}", response_class=HTMLResponse)
|
||||||
async def lnaddress(username: str, request: Request):
|
async def lnaddress(username: str, request: Request):
|
||||||
from lnbits.extensions.lnaddress.lnurl import lnurl_response
|
from lnbits.extensions.lnaddress.lnurl import lnurl_response
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ from lnurl import ( # type: ignore
|
||||||
LnurlPayResponse,
|
LnurlPayResponse,
|
||||||
)
|
)
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
|
from starlette.responses import HTMLResponse
|
||||||
|
|
||||||
from . import lnaddress_ext
|
from . import lnaddress_ext
|
||||||
from .crud import get_address, get_address_by_username, get_domain
|
from .crud import get_address, get_address_by_username, get_domain
|
||||||
|
|
@ -35,10 +36,10 @@ async def lnurl_response(username: str, domain: str, request: Request):
|
||||||
metadata=await address.lnurlpay_metadata(domain=domain),
|
metadata=await address.lnurlpay_metadata(domain=domain),
|
||||||
)
|
)
|
||||||
print("RESP", resp.dict())
|
print("RESP", resp.dict())
|
||||||
return resp
|
return resp.dict()
|
||||||
|
|
||||||
|
|
||||||
@lnaddress_ext.get("/lnurl/cb/{address_id}", name="lnaddress.lnurl_callback")
|
@lnaddress_ext.get("/lnurl/cb/{address_id}", name="lnaddress.lnurl_callback", response_class=HTMLResponse)
|
||||||
async def lnurl_callback(address_id, amount: int = Query(...)):
|
async def lnurl_callback(address_id, amount: int = Query(...)):
|
||||||
print("PING")
|
print("PING")
|
||||||
address = await get_address(address_id)
|
address = await get_address(address_id)
|
||||||
|
|
@ -82,4 +83,4 @@ async def lnurl_callback(address_id, amount: int = Query(...)):
|
||||||
|
|
||||||
resp = LnurlPayActionResponse(pr=r["payment_request"], routes=[])
|
resp = LnurlPayActionResponse(pr=r["payment_request"], routes=[])
|
||||||
|
|
||||||
return resp
|
return resp.dict()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue