remove the need for nostrclient
This commit is contained in:
parent
642cad9ed8
commit
bf6659bbbd
6 changed files with 29 additions and 45 deletions
|
|
@ -23,6 +23,7 @@ LNURL is a range of lightning-network standards that allow us to use lightning-n
|
||||||
|
|
||||||
2. Use the shareable link or view the LNURLp you just created\
|
2. Use the shareable link or view the LNURLp you just created\
|
||||||

|

|
||||||
|
|
||||||
- you can now open your LNURLp and copy the LNURL, get the shareable link or print it\
|
- you can now open your LNURLp and copy the LNURL, get the shareable link or print it\
|
||||||

|

|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,13 @@ from lnbits.helpers import template_renderer
|
||||||
from lnbits.tasks import catch_everything_and_restart
|
from lnbits.tasks import catch_everything_and_restart
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
try:
|
|
||||||
from ..nostrclient.nostr.event import Event
|
|
||||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
|
||||||
|
|
||||||
nostrclient_present = True
|
from .nostr.event import Event
|
||||||
|
from .nostr.key import PrivateKey, PublicKey
|
||||||
|
|
||||||
nostr_privatekey = PrivateKey()
|
nostr_privatekey = PrivateKey()
|
||||||
nostr_publickey: PublicKey = nostr_privatekey.public_key
|
nostr_publickey: PublicKey = nostr_privatekey.public_key
|
||||||
logger.debug(f"LNURLP Zaps Nostr pubkey: {nostr_publickey.hex()}")
|
logger.debug(f"LNURLP Zaps Nostr pubkey: {nostr_publickey.hex()}")
|
||||||
except ImportError:
|
|
||||||
nostrclient_present = False
|
|
||||||
|
|
||||||
db = Database("ext_lnurlp")
|
db = Database("ext_lnurlp")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,5 @@
|
||||||
"name": "LNURLp",
|
"name": "LNURLp",
|
||||||
"short_description": "Make reusable LNURL pay links",
|
"short_description": "Make reusable LNURL pay links",
|
||||||
"tile": "/lnurlp/static/image/lnurl-pay.png",
|
"tile": "/lnurlp/static/image/lnurl-pay.png",
|
||||||
"contributors": [
|
"contributors": ["arcbtc", "eillarra", "fiatjaf", "callebtc"]
|
||||||
"arcbtc",
|
|
||||||
"eillarra",
|
|
||||||
"fiatjaf"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
lnurl.py
7
lnurl.py
|
|
@ -12,13 +12,9 @@ from .crud import increment_pay_link, get_pay_link, get_address_data
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import json
|
import json
|
||||||
from . import nostrclient_present, nostr_publickey
|
from . import nostr_publickey
|
||||||
|
|
||||||
if nostrclient_present:
|
|
||||||
try:
|
|
||||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
||||||
except ImportError:
|
|
||||||
nostrclient_present = False
|
|
||||||
|
|
||||||
|
|
||||||
@lnurlp_ext.get(
|
@lnurlp_ext.get(
|
||||||
|
|
@ -151,7 +147,6 @@ async def api_lnurl_response(request: Request, link_id, lnaddress=False):
|
||||||
if link.comment_chars > 0:
|
if link.comment_chars > 0:
|
||||||
params["commentAllowed"] = link.comment_chars
|
params["commentAllowed"] = link.comment_chars
|
||||||
|
|
||||||
if nostrclient_present:
|
|
||||||
params["allowsNostr"] = True
|
params["allowsNostr"] = True
|
||||||
params["nostrPubkey"] = nostr_publickey.hex()
|
params["nostrPubkey"] = nostr_publickey.hex()
|
||||||
return params
|
return params
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"repos": [
|
"repos": [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
20
tasks.py
20
tasks.py
|
|
@ -12,16 +12,12 @@ from websocket import WebSocketApp
|
||||||
from lnbits.settings import settings
|
from lnbits.settings import settings
|
||||||
from .crud import get_pay_link
|
from .crud import get_pay_link
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from . import nostrclient_present, nostr_privatekey
|
from . import nostr_privatekey
|
||||||
from typing import List
|
from typing import List
|
||||||
import time
|
import time
|
||||||
|
|
||||||
if nostrclient_present:
|
from .nostr.event import Event
|
||||||
try:
|
from .nostr.key import PrivateKey, PublicKey
|
||||||
from ..nostrclient.nostr.event import Event
|
|
||||||
from ..nostrclient.nostr.key import PrivateKey, PublicKey
|
|
||||||
except ImportError:
|
|
||||||
nostrclient_present = False
|
|
||||||
|
|
||||||
|
|
||||||
async def wait_for_paid_invoices():
|
async def wait_for_paid_invoices():
|
||||||
|
|
@ -77,7 +73,7 @@ async def on_invoice_paid(payment: Payment):
|
||||||
|
|
||||||
# NIP-57
|
# NIP-57
|
||||||
nostr = payment.extra.get("nostr")
|
nostr = payment.extra.get("nostr")
|
||||||
if nostrclient_present and nostr:
|
if nostr:
|
||||||
|
|
||||||
event_json = json.loads(nostr)
|
event_json = json.loads(nostr)
|
||||||
|
|
||||||
|
|
@ -117,10 +113,10 @@ async def on_invoice_paid(payment: Payment):
|
||||||
# list of all threads for these websockets
|
# list of all threads for these websockets
|
||||||
wsts: List[Thread] = []
|
wsts: List[Thread] = []
|
||||||
|
|
||||||
# send zap via nostrclient
|
# # send zap via nostrclient
|
||||||
ws, wst = send_zap(f"ws://localhost:{settings.port}/nostrclient/api/v1/relay")
|
# ws, wst = send_zap(f"ws://localhost:{settings.port}/nostrclient/api/v1/relay")
|
||||||
wss += [ws]
|
# wss += [ws]
|
||||||
wsts += [wst]
|
# wsts += [wst]
|
||||||
|
|
||||||
# send zap receipt to relays in zap request
|
# send zap receipt to relays in zap request
|
||||||
relays = get_tag(event_json, "relays")
|
relays = get_tag(event_json, "relays")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue