Removing -
from roomHash
This commit is contained in:
parent
16bed36624
commit
808c8c48b2
12
server.js
12
server.js
@ -55,12 +55,18 @@ server.listen(port, function() {
|
||||
});
|
||||
|
||||
|
||||
function minifyRoomHash(hash) {
|
||||
let text = hash.replace(new RegExp('[^A-Z^a-z^0-9]', 'g'), '');
|
||||
text += 'roomID';
|
||||
return text.slice(0, 6);
|
||||
}
|
||||
|
||||
/*
|
||||
* Rooms related methods
|
||||
*/
|
||||
|
||||
function getRoom(socket) {
|
||||
var room = socket.room ? socket.room.slice(0, 6) : socket.room;
|
||||
var room = socket.room ? minifyRoomHash(socket.room) : socket.room;
|
||||
if (rooms[room] === undefined) {
|
||||
createRoom(room);
|
||||
}
|
||||
@ -165,7 +171,7 @@ io.on('connection', function(socket) {
|
||||
});
|
||||
|
||||
socket.on('subscribeToStream', function (data){
|
||||
joinRoom(socket, data ? data.slice(0, 6) : data);
|
||||
joinRoom(socket, data ? minifyRoomHash(data) : data);
|
||||
var room = getRoom(socket);
|
||||
if (room.presenter) {
|
||||
socket.emit('streamStarted');
|
||||
@ -177,7 +183,7 @@ io.on('connection', function(socket) {
|
||||
});
|
||||
|
||||
socket.on('joinRoom', function (data) {
|
||||
joinRoom(socket, data ? data.slice(0, 6) : data)
|
||||
joinRoom(socket, data ? minifyRoomHash(data) : data)
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user