chore: rename websocketUpdater (#21)

* chore: rename `websocketUpdater`
https://github.com/lnbits/lnbits/pull/2377
This commit is contained in:
dni ⚡ 2024-04-12 12:11:03 +02:00 committed by GitHub
parent 43eed0df35
commit 349bfa49d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -3,5 +3,5 @@
"short_description": "One click launch your own relay!",
"tile": "/nostrrelay/static/image/nostrrelay.png",
"contributors": ["arcbtc", "DCs"],
"min_lnbits_version": "0.11.0"
"min_lnbits_version": "0.12.6"
}

View file

@ -4,7 +4,7 @@ import json
from loguru import logger
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.tasks import register_invoice_listener
@ -32,13 +32,13 @@ async def on_invoice_paid(payment: Payment):
if not relay_id or not pubkey:
message = f"Invoice extra data missing for 'relay_id' and 'pubkey'. Payment hash: {hash}"
logger.warning(message)
await websocketUpdater(hash, json.dumps({"success": False, "message": message}))
await websocket_updater(hash, json.dumps({"success": False, "message": message}))
return
action = payment.extra.get("action")
if action == "join":
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
if action == "storage":
@ -50,10 +50,10 @@ async def on_invoice_paid(payment: Payment):
logger.warning(message)
return
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
await websocketUpdater(
await websocket_updater(
hash, json.dumps({"success": False, "message": f"Bad action name: '{action}'"})
)