fix everyone gets chat msgs, fix fb adding to url

This commit is contained in:
ian ramzy 2020-03-29 19:50:31 -04:00
parent a0030f1b12
commit ab8e43012e
2 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,13 @@
// strip url parameters
if (window.location.href.indexOf('?') > -1) {
window.location.href = window.location.href.split('?')[0];
}
if (window.location.pathname === "/room") { if (window.location.pathname === "/room") {
window.location.href = "/landing/newroom"; window.location.href = "/landing/newroom";
} }
url = window.location.href; url = window.location.href;
const roomHash = url.substring(url.lastIndexOf('/') + 1).toLowerCase(); const roomHash = url.substring(url.lastIndexOf('/') + 1).toLowerCase();
document.title = 'Neon Chat - ' + url.substring(url.lastIndexOf('/') + 1); document.title = 'Neon Chat - ' + url.substring(url.lastIndexOf('/') + 1);
@ -569,7 +575,7 @@ var socket = VideoChat.socket;
input.addEventListener('keypress', function (event) { input.addEventListener('keypress', function (event) {
if (event.keyCode === 13) { if (event.keyCode === 13) {
event.preventDefault(); event.preventDefault();
socket.emit('chat message', input.value); socket.emit('chat message', input.value, roomHash);
$('.chat-messages').append('<div class="message-item customer"><div class="message-bloc"><div class="message">' + input.value + '</div></div></div>'); $('.chat-messages').append('<div class="message-item customer"><div class="message-bloc"><div class="message">' + input.value + '</div></div></div>');
$('#chat-zone').scrollTop($('#chat-zone')[0].scrollHeight); $('#chat-zone').scrollTop($('#chat-zone')[0].scrollHeight);
input.value = ''; input.value = '';

View File

@ -88,7 +88,7 @@ io.on('connection', function (socket) {
// Relay answers // Relay answers
socket.on('sendCaptions', function (captions, room) { socket.on('sendCaptions', function (captions, room) {
logIt(captions, room); // logIt(captions, room);
socket.broadcast.to(room).emit('recieveCaptions', captions); socket.broadcast.to(room).emit('recieveCaptions', captions);
}); });
@ -99,8 +99,8 @@ io.on('connection', function (socket) {
}); });
// Relay chat messages // Relay chat messages
socket.on('chat message', function(msg){ socket.on('chat message', function(msg, room){
socket.broadcast.emit('chat message', msg); socket.broadcast.to(room).emit('chat message', msg);
}); });