chore: rename websocketUpdater (#21)
* chore: rename `websocketUpdater` https://github.com/lnbits/lnbits/pull/2377
This commit is contained in:
parent
43eed0df35
commit
349bfa49d1
2 changed files with 6 additions and 6 deletions
|
|
@ -3,5 +3,5 @@
|
||||||
"short_description": "One click launch your own relay!",
|
"short_description": "One click launch your own relay!",
|
||||||
"tile": "/nostrrelay/static/image/nostrrelay.png",
|
"tile": "/nostrrelay/static/image/nostrrelay.png",
|
||||||
"contributors": ["arcbtc", "DCs"],
|
"contributors": ["arcbtc", "DCs"],
|
||||||
"min_lnbits_version": "0.11.0"
|
"min_lnbits_version": "0.12.6"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
tasks.py
10
tasks.py
|
|
@ -4,7 +4,7 @@ import json
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
from lnbits.core.models import Payment
|
from lnbits.core.models import Payment
|
||||||
from lnbits.core.services import websocketUpdater
|
from lnbits.core.services import websocket_updater
|
||||||
from lnbits.helpers import get_current_extension_name
|
from lnbits.helpers import get_current_extension_name
|
||||||
from lnbits.tasks import register_invoice_listener
|
from lnbits.tasks import register_invoice_listener
|
||||||
|
|
||||||
|
|
@ -32,13 +32,13 @@ async def on_invoice_paid(payment: Payment):
|
||||||
if not relay_id or not pubkey:
|
if not relay_id or not pubkey:
|
||||||
message = f"Invoice extra data missing for 'relay_id' and 'pubkey'. Payment hash: {hash}"
|
message = f"Invoice extra data missing for 'relay_id' and 'pubkey'. Payment hash: {hash}"
|
||||||
logger.warning(message)
|
logger.warning(message)
|
||||||
await websocketUpdater(hash, json.dumps({"success": False, "message": message}))
|
await websocket_updater(hash, json.dumps({"success": False, "message": message}))
|
||||||
return
|
return
|
||||||
|
|
||||||
action = payment.extra.get("action")
|
action = payment.extra.get("action")
|
||||||
if action == "join":
|
if action == "join":
|
||||||
await invoice_paid_to_join(relay_id, pubkey, payment.amount)
|
await invoice_paid_to_join(relay_id, pubkey, payment.amount)
|
||||||
await websocketUpdater(hash, json.dumps({"success": True}))
|
await websocket_updater(hash, json.dumps({"success": True}))
|
||||||
return
|
return
|
||||||
|
|
||||||
if action == "storage":
|
if action == "storage":
|
||||||
|
|
@ -50,10 +50,10 @@ async def on_invoice_paid(payment: Payment):
|
||||||
logger.warning(message)
|
logger.warning(message)
|
||||||
return
|
return
|
||||||
await invoice_paid_for_storage(relay_id, pubkey, storage_to_buy, payment.amount)
|
await invoice_paid_for_storage(relay_id, pubkey, storage_to_buy, payment.amount)
|
||||||
await websocketUpdater(hash, json.dumps({"success": True}))
|
await websocket_updater(hash, json.dumps({"success": True}))
|
||||||
return
|
return
|
||||||
|
|
||||||
await websocketUpdater(
|
await websocket_updater(
|
||||||
hash, json.dumps({"success": False, "message": f"Bad action name: '{action}'"})
|
hash, json.dumps({"success": False, "message": f"Bad action name: '{action}'"})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue