|
|
@ -724,10 +724,9 @@ function initVroom(room) { |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
req: JSON.stringify({ |
|
|
|
req: JSON.stringify({ |
|
|
|
action: 'get_room_info', |
|
|
|
action: 'get_room_conf', |
|
|
|
param: { |
|
|
|
param: { |
|
|
|
room: roomName, |
|
|
|
room: roomName, |
|
|
|
peer_id: peers.local.id |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -735,42 +734,21 @@ function initVroom(room) { |
|
|
|
showApiError(data); |
|
|
|
showApiError(data); |
|
|
|
}, |
|
|
|
}, |
|
|
|
success: function(data){ |
|
|
|
success: function(data){ |
|
|
|
// Notify others if our role changed
|
|
|
|
|
|
|
|
if (data.role != peers.local.role){ |
|
|
|
|
|
|
|
webrtc.sendToAll('role_change', {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
peers.local.role = data.role; |
|
|
|
|
|
|
|
roomInfo = data; |
|
|
|
roomInfo = data; |
|
|
|
// Enable owner reserved menu
|
|
|
|
// Reset the list of email displayed, so first remove evry input field but the last one
|
|
|
|
if (data.role == 'owner'){ |
|
|
|
// We keep it so we can clone it again
|
|
|
|
$('.unauthEl').hide(500); |
|
|
|
$('.email-list').find('.email-entry:not(:last)').remove(); |
|
|
|
$('.ownerEl').show(500); |
|
|
|
$.each(data.notif, function(index, obj){ |
|
|
|
// Reset the list of email displayed, so first remove evry input field but the last one
|
|
|
|
addEmailInputField('email-list-notification', obj.email); |
|
|
|
// We keep it so we can clone it again
|
|
|
|
}); |
|
|
|
$('.email-list').find('.email-entry:not(:last)').remove(); |
|
|
|
// Now, remove the first one if the list is not empty
|
|
|
|
$.each(data.notif, function(index, obj){ |
|
|
|
if (Object.keys(data.notif).length > 0){ |
|
|
|
addEmailInputField('email-list-notification', obj.email); |
|
|
|
$('.email-list').find('.email-entry:first').remove(); |
|
|
|
}); |
|
|
|
|
|
|
|
// Now, remove the first one if the list is not empty
|
|
|
|
|
|
|
|
if (Object.keys(data.notif).length > 0){ |
|
|
|
|
|
|
|
$('.email-list').find('.email-entry:first').remove(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
$('.email-list').find('.email-entry:first').find('input:first').val(''); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
adjustAddRemoveEmailButtons(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// We're are not owner of the room
|
|
|
|
|
|
|
|
else{ |
|
|
|
else{ |
|
|
|
// Hide owner reserved elements
|
|
|
|
$('.email-list').find('.email-entry:first').find('input:first').val(''); |
|
|
|
$('.ownerEl').hide(500); |
|
|
|
|
|
|
|
if (data.owner_auth){ |
|
|
|
|
|
|
|
$('.unauthEl').show(500); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
$('.unauthEl').hide(500); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
adjustAddRemoveEmailButtons(); |
|
|
|
// Update config switches
|
|
|
|
// Update config switches
|
|
|
|
$('#lockedSet').bootstrapSwitch('state', data.locked); |
|
|
|
$('#lockedSet').bootstrapSwitch('state', data.locked); |
|
|
|
$('#askForNameSet').bootstrapSwitch('state', data.ask_for_name); |
|
|
|
$('#askForNameSet').bootstrapSwitch('state', data.ask_for_name); |
|
|
@ -804,7 +782,23 @@ function initVroom(room) { |
|
|
|
showApiError(data); |
|
|
|
showApiError(data); |
|
|
|
}, |
|
|
|
}, |
|
|
|
success: function(data){ |
|
|
|
success: function(data){ |
|
|
|
if (peers[id]){ |
|
|
|
if (id === peers.local.id){ |
|
|
|
|
|
|
|
if (data.role != peers.local.role){ |
|
|
|
|
|
|
|
webrtc.sendToAll('role_change', {}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
peers.local.role = data.role; |
|
|
|
|
|
|
|
if (data.role == 'owner'){ |
|
|
|
|
|
|
|
$('.unauthEl').hide(500); |
|
|
|
|
|
|
|
$('.ownerEl').show(500); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
if (roomInfo.owner_auth){ |
|
|
|
|
|
|
|
$('.unauthEl').show(500); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$('.ownerEl').hide(500); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if (peers[id]){ |
|
|
|
peers[id].role = data.role; |
|
|
|
peers[id].role = data.role; |
|
|
|
if (data.role == 'owner'){ |
|
|
|
if (data.role == 'owner'){ |
|
|
|
// If this peer is a owner, we add the mark on its preview
|
|
|
|
// If this peer is a owner, we add the mark on its preview
|
|
|
@ -1320,7 +1314,7 @@ function initVroom(room) { |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){ |
|
|
|
if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){ |
|
|
|
var who = (peers[data.id].hasName) ? peers[data.id].displayName : localize('A_ROOM_ADMIN'); |
|
|
|
var who = (peers[data.id].hasName) ? peers[data.id].displayName : localize('A_ROOM_ADMIN'); |
|
|
|
getRoomInfo(); |
|
|
|
getPeerRole(peers.local.id); |
|
|
|
if (peers.local.role == 'owner'){ |
|
|
|
if (peers.local.role == 'owner'){ |
|
|
|
$.notify(sprintf(localize('s_IS_PROMOTING_YOU'), who), 'success'); |
|
|
|
$.notify(sprintf(localize('s_IS_PROMOTING_YOU'), who), 'success'); |
|
|
|
} |
|
|
|
} |
|
|
@ -1523,32 +1517,32 @@ function initVroom(room) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, 10000); |
|
|
|
}, 10000); |
|
|
|
// Ping the room every minutes
|
|
|
|
} |
|
|
|
// Used to detect inactive rooms
|
|
|
|
// Ping the room every minutes
|
|
|
|
setInterval(function(){ |
|
|
|
// Used to detect inactive rooms
|
|
|
|
$.ajax({ |
|
|
|
setInterval(function(){ |
|
|
|
data: { |
|
|
|
$.ajax({ |
|
|
|
req: JSON.stringify({ |
|
|
|
data: { |
|
|
|
action: 'ping', |
|
|
|
req: JSON.stringify({ |
|
|
|
param: { |
|
|
|
action: 'ping', |
|
|
|
room: roomName |
|
|
|
param: { |
|
|
|
} |
|
|
|
room: roomName |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error: function(data) { |
|
|
|
|
|
|
|
showApiError(data); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
success: function(data) { |
|
|
|
|
|
|
|
if (data.msg && data.msg != ''){ |
|
|
|
|
|
|
|
$.notify(data.msg, { |
|
|
|
|
|
|
|
className: 'info', |
|
|
|
|
|
|
|
autoHide: false |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error: function(data) { |
|
|
|
|
|
|
|
showApiError(data); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
success: function(data) { |
|
|
|
|
|
|
|
if (data.msg && data.msg != ''){ |
|
|
|
|
|
|
|
$.notify(data.msg, { |
|
|
|
|
|
|
|
className: 'info', |
|
|
|
|
|
|
|
autoHide: false |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, 60000); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, 60000); |
|
|
|
// Notify the server a new participant has joined (ourself)
|
|
|
|
// Notify the server a new participant has joined (ourself)
|
|
|
|
// If we were prompted for our display name before joining
|
|
|
|
// If we were prompted for our display name before joining
|
|
|
|
// we send it. Not that I like sending this kind of data to the server
|
|
|
|
// we send it. Not that I like sending this kind of data to the server
|
|
|
@ -1559,7 +1553,8 @@ function initVroom(room) { |
|
|
|
action: 'join', |
|
|
|
action: 'join', |
|
|
|
param: { |
|
|
|
param: { |
|
|
|
room: roomName, |
|
|
|
room: roomName, |
|
|
|
name: (peers.local.hasName) ? peers.local.displayName : '' |
|
|
|
name: (peers.local.hasName) ? peers.local.displayName : '', |
|
|
|
|
|
|
|
peer_id: peers.local.id |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -1572,6 +1567,7 @@ function initVroom(room) { |
|
|
|
} |
|
|
|
} |
|
|
|
$('#videoLocalContainer').show(200); |
|
|
|
$('#videoLocalContainer').show(200); |
|
|
|
$('#timeCounterXs,#timeCounter').tinyTimer({ from: new Date }); |
|
|
|
$('#timeCounterXs,#timeCounter').tinyTimer({ from: new Date }); |
|
|
|
|
|
|
|
getPeerRole(peers.local.id); |
|
|
|
setTimeout(function(){ |
|
|
|
setTimeout(function(){ |
|
|
|
$('#connecting').modal('hide'); |
|
|
|
$('#connecting').modal('hide'); |
|
|
|
}, 200); |
|
|
|
}, 200); |
|
|
@ -1884,7 +1880,7 @@ function initVroom(room) { |
|
|
|
success: function(data){ |
|
|
|
success: function(data){ |
|
|
|
$('#authPass').val(''); |
|
|
|
$('#authPass').val(''); |
|
|
|
$('#ownerAuthModal').modal('hide'); |
|
|
|
$('#ownerAuthModal').modal('hide'); |
|
|
|
getRoomInfo(); |
|
|
|
getPeerRole(peers.local.id); |
|
|
|
$('#joinPassFields,#ownerPassFields').hide(); |
|
|
|
$('#joinPassFields,#ownerPassFields').hide(); |
|
|
|
$.notify(data.msg, 'success'); |
|
|
|
$.notify(data.msg, 'success'); |
|
|
|
} |
|
|
|
} |
|
|
|