From 68ef6b3d25f8b9a3af50ad697f28fda932611daf Mon Sep 17 00:00:00 2001 From: Mathieu Dombrock Date: Sun, 26 Feb 2023 19:33:36 -0800 Subject: [PATCH] update ui --- client/index.html | 2 +- client/webrtc.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/index.html b/client/index.html index 2d8c3de..f06922b 100755 --- a/client/index.html +++ b/client/index.html @@ -14,7 +14,7 @@
You
-
Remote
+
Peer
diff --git a/client/webrtc.js b/client/webrtc.js index 07330fb..be37df4 100755 --- a/client/webrtc.js +++ b/client/webrtc.js @@ -82,21 +82,21 @@ function addStatus(msg){ function sendMsg(){ let content = _dom.chatInput.value; const msg = { - uuid: _s.uuid, + sender: 'Peer', content: content }; _s.dataChannel.send(JSON.stringify(msg, null, 2)); // write local content = content.replace(_s.uuid, 'You'); - writeMsg({uuid:'You', content}); + writeMsg({sender:'You', content}); _dom.chatInput.value = ''; } function writeMsg(msg){ let content = msg.content; - const origin = msg.uuid || 'System >> '; + const origin = msg.sender || 'System'; content = content.replace(/(?:\r\n|\r|\n)/g, '
'); - const out = '
' + origin + ': ' + content + '
'; + const out = '
' + origin + ': ' + content + '
'; _dom.msgArea.innerHTML += out; _dom.msgArea.scrollTop = msgArea.scrollHeight; } @@ -128,7 +128,7 @@ function setupDataChannel(){ _s.dataChannel.onopen = () => { // The data channel is now open // You can now send data - const msg = {uuid: _s.uuid, content: 'CONNECTED!'}; + const msg = {sender: _s.uuid, content: 'Connected!'}; _s.dataChannel.send(JSON.stringify(msg, null, 2)); showChat(true); }