mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-27 12:26:19 +02:00
added updater function
This commit is contained in:
@@ -7,6 +7,7 @@ from lnbits.core.models import Payment
|
|||||||
from lnbits.tasks import register_invoice_listener
|
from lnbits.tasks import register_invoice_listener
|
||||||
|
|
||||||
from .crud import get_copilot
|
from .crud import get_copilot
|
||||||
|
from .views import updater
|
||||||
import shortuuid
|
import shortuuid
|
||||||
|
|
||||||
async def register_listeners():
|
async def register_listeners():
|
||||||
@@ -69,10 +70,7 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||||||
await mark_webhook_sent(payment, r.status_code)
|
await mark_webhook_sent(payment, r.status_code)
|
||||||
except (httpx.ConnectError, httpx.RequestError):
|
except (httpx.ConnectError, httpx.RequestError):
|
||||||
await mark_webhook_sent(payment, -1)
|
await mark_webhook_sent(payment, -1)
|
||||||
global connected_websockets
|
await updater(data, payment.extra.get("comment"), copilot.id)
|
||||||
connected_websockets[copilot.id] = (
|
|
||||||
shortuuid.uuid() + "-" + data + "-" + payment.extra.get("comment")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def mark_webhook_sent(payment: Payment, status: int) -> None:
|
async def mark_webhook_sent(payment: Payment, status: int) -> None:
|
||||||
|
@@ -64,3 +64,9 @@ async def panel(copilot_id):
|
|||||||
HTTPStatus.NOT_FOUND, "Copilot link does not exist."
|
HTTPStatus.NOT_FOUND, "Copilot link does not exist."
|
||||||
)
|
)
|
||||||
return await render_template("copilot/panel.html", copilot=copilot)
|
return await render_template("copilot/panel.html", copilot=copilot)
|
||||||
|
|
||||||
|
async def updater(data, comment, copilot):
|
||||||
|
global connected_websockets
|
||||||
|
connected_websockets[copilot] = (
|
||||||
|
shortuuid.uuid() + "-" + data + "-" + comment
|
||||||
|
)
|
Reference in New Issue
Block a user