mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 20:42:32 +02:00
black
This commit is contained in:
@@ -75,6 +75,7 @@ async def on_invoice_paid(payment: Payment) -> None:
|
|||||||
else:
|
else:
|
||||||
await updater(copilot.id, data, "none")
|
await updater(copilot.id, data, "none")
|
||||||
|
|
||||||
|
|
||||||
async def mark_webhook_sent(payment: Payment, status: int) -> None:
|
async def mark_webhook_sent(payment: Payment, status: int) -> None:
|
||||||
payment.extra["wh_status"] = status
|
payment.extra["wh_status"] = status
|
||||||
|
|
||||||
|
@@ -138,8 +138,8 @@
|
|||||||
pushAnim(content) {
|
pushAnim(content) {
|
||||||
document.getElementById('animations').style.width = content[0]
|
document.getElementById('animations').style.width = content[0]
|
||||||
document.getElementById('animations').src = content[1]
|
document.getElementById('animations').src = content[1]
|
||||||
if (content[1] != 'none') {
|
if (content[2] != 'none') {
|
||||||
self.showNotif(content[1])
|
self.showNotif(content[2])
|
||||||
}
|
}
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
document.getElementById('animations').src = ''
|
document.getElementById('animations').src = ''
|
||||||
|
@@ -11,12 +11,14 @@ import trio
|
|||||||
import shortuuid
|
import shortuuid
|
||||||
from . import copilot_ext
|
from . import copilot_ext
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.route("/")
|
@copilot_ext.route("/")
|
||||||
@validate_uuids(["usr"], required=True)
|
@validate_uuids(["usr"], required=True)
|
||||||
@check_user_exists()
|
@check_user_exists()
|
||||||
async def index():
|
async def index():
|
||||||
return await render_template("copilot/index.html", user=g.user)
|
return await render_template("copilot/index.html", user=g.user)
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.route("/cp/")
|
@copilot_ext.route("/cp/")
|
||||||
async def compose():
|
async def compose():
|
||||||
return await render_template("copilot/compose.html")
|
return await render_template("copilot/compose.html")
|
||||||
@@ -34,6 +36,7 @@ async def panel():
|
|||||||
|
|
||||||
connected_websockets = defaultdict(set)
|
connected_websockets = defaultdict(set)
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.websocket("/ws/<id>/")
|
@copilot_ext.websocket("/ws/<id>/")
|
||||||
async def wss(id):
|
async def wss(id):
|
||||||
copilot = await get_copilot(id)
|
copilot = await get_copilot(id)
|
||||||
@@ -50,9 +53,10 @@ async def wss(id):
|
|||||||
finally:
|
finally:
|
||||||
connected_websockets[id].remove(send_channel)
|
connected_websockets[id].remove(send_channel)
|
||||||
|
|
||||||
|
|
||||||
async def updater(copilot_id, data, comment):
|
async def updater(copilot_id, data, comment):
|
||||||
copilot = await get_copilot(copilot_id)
|
copilot = await get_copilot(copilot_id)
|
||||||
if not copilot:
|
if not copilot:
|
||||||
return
|
return
|
||||||
for queue in connected_websockets[copilot_id]:
|
for queue in connected_websockets[copilot_id]:
|
||||||
await queue.send(f"{data + '-' + comment}")
|
await queue.send(f"{data + '-' + comment}")
|
||||||
|
@@ -80,9 +80,9 @@ async def api_copilot_retrieve(copilot_id):
|
|||||||
HTTPStatus.OK,
|
HTTPStatus.OK,
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
jsonify({**copilot._asdict(), **{"lnurl": copilot.lnurl}}),
|
jsonify({**copilot._asdict(), **{"lnurl": copilot.lnurl}}),
|
||||||
HTTPStatus.OK,
|
HTTPStatus.OK,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.route("/api/v1/copilot/<copilot_id>", methods=["DELETE"])
|
@copilot_ext.route("/api/v1/copilot/<copilot_id>", methods=["DELETE"])
|
||||||
|
Reference in New Issue
Block a user