From cb6f9e1f720ce7390d4a9d90045b76845f5e9f9c Mon Sep 17 00:00:00 2001 From: Stefan Stammberger Date: Sat, 16 Oct 2021 13:35:50 +0200 Subject: [PATCH] fix: copilot websocket connections --- lnbits/extensions/copilot/templates/copilot/compose.html | 6 ++---- lnbits/extensions/copilot/views.py | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lnbits/extensions/copilot/templates/copilot/compose.html b/lnbits/extensions/copilot/templates/copilot/compose.html index 44664b1a2..87979bdae 100644 --- a/lnbits/extensions/copilot/templates/copilot/compose.html +++ b/lnbits/extensions/copilot/templates/copilot/compose.html @@ -239,8 +239,7 @@ ':' + location.port + '/copilot/ws/' + - self.copilot.id + - '/' + self.copilot.id } else { localUrl = 'ws://' + @@ -248,8 +247,7 @@ ':' + location.port + '/copilot/ws/' + - self.copilot.id + - '/' + self.copilot.id } this.connection = new WebSocket(localUrl) this.connection.onmessage = function (e) { diff --git a/lnbits/extensions/copilot/views.py b/lnbits/extensions/copilot/views.py index 516bf4e38..544ecc49c 100644 --- a/lnbits/extensions/copilot/views.py +++ b/lnbits/extensions/copilot/views.py @@ -1,4 +1,5 @@ from http import HTTPStatus +from typing import List import httpx from collections import defaultdict from lnbits.decorators import check_user_exists @@ -70,7 +71,7 @@ class ConnectionManager: manager = ConnectionManager() -@copilot_ext.websocket("/ws/{socket_id}") +@copilot_ext.websocket("/copilot/ws/{socket_id}", name="copilot.websocket_by_id") async def websocket_endpoint(websocket: WebSocket, socket_id: str): await manager.connect(websocket) try: