diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index be09bae0..cbfd7c5f 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -120,8 +120,13 @@ function jumpBySteps(steps) { } } -function sendChatMessage(message) { - ws.send(JSON.stringify({ "type": "sendmessage", "text": message })); +function recvChatMessage(sender, text) { + divlog('' + sender + ': ' + + text + '', false); +} + +function sendChatMessage(text) { + ws.send(JSON.stringify({ "type": "sendmessage", "text": text })); } var waterfall_min_level; @@ -1173,7 +1178,7 @@ function on_ws_recv(evt) { divlog(json['value'], true); break; case 'chat_message': - divlog(json['sender'] + ': ' + json['text'], true); + recvChatMessage(json['sender'], json['text']); break; case 'backoff': divlog("Server is currently busy: " + json['reason'], true); diff --git a/owrx/connection.py b/owrx/connection.py index e48128ad..67a6cc0f 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -21,6 +21,7 @@ from abc import ABCMeta, abstractmethod import json import threading import struct +import re import logging @@ -345,7 +346,8 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient): elif message["type"] == "sendmessage": if "text" in message: ClientRegistry.getSharedInstance().broadcastChatMessage( - self.conn.getIp(), message["text"] + re.sub("^::ffff:", "", self.conn.getIp()), + message["text"] ) else: