Very hacky checker for websockets
Looking pretty fucking dope Added some extra gifs Added wallet, lnurl generation should work Damn you lnurl check https for wss added z for lnurlp zindex to the moon zindex to moon lnurl too big in ambition lnurl big copy/paste bug address attach lnurl to view please work lnurl bug lnurl bug bigger lnurl added reconect button me bug await a string
This commit is contained in:
@@ -6,11 +6,27 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||
from . import copilot_ext
|
||||
from .crud import get_copilot
|
||||
|
||||
@copilot_ext.websocket('/ws')
|
||||
async def ws():
|
||||
from quart import g, abort, render_template, jsonify, websocket
|
||||
from functools import wraps
|
||||
import trio
|
||||
import shortuuid
|
||||
from . import copilot_ext
|
||||
|
||||
connected_websockets = {}
|
||||
|
||||
@copilot_ext.websocket('/ws/panel/<copilot_id>')
|
||||
async def ws_panel(copilot_id):
|
||||
global connected_websockets
|
||||
while True:
|
||||
data = await websocket.receive()
|
||||
await websocket.send(f"echo {data}")
|
||||
connected_websockets[copilot_id] = shortuuid.uuid() + '-' + data
|
||||
|
||||
@copilot_ext.websocket('/ws/compose/<copilot_id>')
|
||||
async def ws_compose(copilot_id):
|
||||
global connected_websockets
|
||||
while True:
|
||||
data = await websocket.receive()
|
||||
await websocket.send(connected_websockets[copilot_id])
|
||||
|
||||
@copilot_ext.route("/")
|
||||
@validate_uuids(["usr"], required=True)
|
||||
@@ -24,7 +40,7 @@ async def compose(copilot_id):
|
||||
copilot = await get_copilot(copilot_id) or abort(
|
||||
HTTPStatus.NOT_FOUND, "Copilot link does not exist."
|
||||
)
|
||||
return await render_template("copilot/compose.html", copilot=copilot)
|
||||
return await render_template("copilot/compose.html", copilot=copilot, lnurl=copilot.lnurl)
|
||||
|
||||
@copilot_ext.route("/<copilot_id>")
|
||||
async def panel(copilot_id):
|
||||
|
||||
Reference in New Issue
Block a user