clean
This commit is contained in:
parent
8c5a494489
commit
f2615aa155
2 changed files with 4 additions and 15 deletions
14
lnurl.py
14
lnurl.py
|
|
@ -78,16 +78,10 @@ async def api_lnurl_callback(
|
||||||
if comment:
|
if comment:
|
||||||
extra["comment"] = (comment,)
|
extra["comment"] = (comment,)
|
||||||
|
|
||||||
|
# nip 57
|
||||||
nostr = request.query_params.get("nostr")
|
nostr = request.query_params.get("nostr")
|
||||||
nostr_description = ""
|
|
||||||
if nostr:
|
if nostr:
|
||||||
extra["nostr"] = nostr
|
extra["nostr"] = nostr # put it here for later publishing in tasks.py
|
||||||
# print("HASHING THIS")
|
|
||||||
nostr_description = nostr # json.dumps(nostr)[1:-1] # json.dumps supposedly makes escaped "-s, remove leading and trailing "
|
|
||||||
# print(nostr_description)
|
|
||||||
import hashlib
|
|
||||||
|
|
||||||
print(hashlib.sha256(nostr_description.encode()).hexdigest())
|
|
||||||
|
|
||||||
if lnaddress and link.username and link.domain:
|
if lnaddress and link.username and link.domain:
|
||||||
extra["lnaddress"] = f"{link.username}@{link.domain}"
|
extra["lnaddress"] = f"{link.username}@{link.domain}"
|
||||||
|
|
@ -96,8 +90,8 @@ async def api_lnurl_callback(
|
||||||
wallet_id=link.wallet,
|
wallet_id=link.wallet,
|
||||||
amount=int(amount / 1000),
|
amount=int(amount / 1000),
|
||||||
memo=link.description,
|
memo=link.description,
|
||||||
unhashed_description=nostr_description.encode()
|
unhashed_description=nostr.encode()
|
||||||
if nostr
|
if nostr # we take the zap request as the description instead of the LNURL metadata if present
|
||||||
else link.lnurlpay_metadata.encode(),
|
else link.lnurlpay_metadata.encode(),
|
||||||
extra=extra,
|
extra=extra,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
5
tasks.py
5
tasks.py
|
|
@ -103,11 +103,6 @@ async def on_invoice_paid(payment: Payment):
|
||||||
ws.send(zap_receipt.to_message())
|
ws.send(zap_receipt.to_message())
|
||||||
ws.close()
|
ws.close()
|
||||||
|
|
||||||
from lnbits.core import bolt11
|
|
||||||
|
|
||||||
print(
|
|
||||||
f"Invoice description hash: {bolt11.decode(payment.bolt11).description_hash}"
|
|
||||||
)
|
|
||||||
ws = WebSocketApp(
|
ws = WebSocketApp(
|
||||||
f"ws://localhost:{settings.port}/nostrclient/api/v1/relay",
|
f"ws://localhost:{settings.port}/nostrclient/api/v1/relay",
|
||||||
on_open=send_event,
|
on_open=send_event,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue