Prevent muting/suspending/kicking other owners

Also print a few notifications
master
Daniel Berteaud 11 years ago
parent 090cd85cbe
commit 24bee4d6f8
  1. 6
      lib/Vroom/I18N/en.pm
  2. 6
      lib/Vroom/I18N/fr.pm
  3. 38
      public/js/vroom.js

@ -104,6 +104,12 @@ our %Lexicon = (
"KICKED" => "Kicked", "KICKED" => "Kicked",
"YOU_HAVE_BEEN_KICKED" => "You've been kicked out of the room", "YOU_HAVE_BEEN_KICKED" => "You've been kicked out of the room",
"AN_ADMIN_HAS_KICKED_YOU" => "An administrator of the room has excluded you", "AN_ADMIN_HAS_KICKED_YOU" => "An administrator of the room has excluded you",
"YOU_HAVE_MUTED_s" => "You have muted %s's microphone",
"CANT_MUTE_OWNER" => "You can't mute the microphone of this participant",
"YOU_HAVE_SUSPENDED_s" => "You have suspended %s's webcam",
"CANT_SUSPEND_OWNER" => "You can't suspend this participant's webcam",
"YOU_HAVE_KICKED_s" => "You have kicked %s out of the room",
"CANT_KICK_OWNER" => "You can't kick this participant out of the room",
"MIC_MUTED" => "Your microphone is now muted", "MIC_MUTED" => "Your microphone is now muted",
"MIC_UNMUTED" => "Your microphone is now unmuted", "MIC_UNMUTED" => "Your microphone is now unmuted",
"CAM_SUSPENDED" => "Your webcam is now suspended", "CAM_SUSPENDED" => "Your webcam is now suspended",

@ -110,6 +110,12 @@ our %Lexicon = (
"KICKED" => "Éjecté", "KICKED" => "Éjecté",
"YOU_HAVE_BEEN_KICKED" => "Vous avez été éjecté du salon", "YOU_HAVE_BEEN_KICKED" => "Vous avez été éjecté du salon",
"AN_ADMIN_HAS_KICKED_YOU" => "Un administrateur du salon vous a exclus", "AN_ADMIN_HAS_KICKED_YOU" => "Un administrateur du salon vous a exclus",
"YOU_HAVE_MUTED_s" => "Vous avez coupé le micro de %s",
"CANT_MUTE_OWNER" => "Vous ne pouvez pas couper le micro de ce participant",
"YOU_HAVE_SUSPENDED_s" => "Vous avez mis la webcam de %s en pause",
"CANT_SUSPEND_OWNER" => "Vous ne pouvez pas mettre la webcam de ce participant en pause",
"YOU_HAVE_KICKED_s" => "Vous avez bani %s du salon",
"CANT_KICK_OWNER" => "Vous ne pouvez pas bannir ce participant",
"MIC_MUTED" => "Votre micro est coupé", "MIC_MUTED" => "Votre micro est coupé",
"MIC_UNMUTED" => "Votre micro est à nouveau actif", "MIC_UNMUTED" => "Votre micro est à nouveau actif",
"CAM_SUSPENDED" => "Votre webcam est en pause", "CAM_SUSPENDED" => "Votre webcam est en pause",

@ -43,7 +43,13 @@ var locale = {
s_IS_KICKING_s: '', s_IS_KICKING_s: '',
MUTE_PEER: '', MUTE_PEER: '',
SUSPEND_PEER: '', SUSPEND_PEER: '',
KICK_PEER: '' KICK_PEER: '',
YOU_HAVE_MUTED_s: '',
CANT_MUTE_OWNER: '',
YOU_HAVE_SUSPENDED_s: '',
CANT_SUSPEND_OWNER: '',
YOU_HAVE_KICKED_s: '',
CANT_KICK_OWNER: ''
}; };
// Localize the strings we need // Localize the strings we need
@ -430,14 +436,27 @@ function initVroom(room) {
// Mute a peer // Mute a peer
function mutePeer(id){ function mutePeer(id){
if (peers[id] && peers[id].role != 'owner'){
webrtc.sendToAll('owner_mute', {peer: id}); webrtc.sendToAll('owner_mute', {peer: id});
$.notify(sprintf(locale.YOU_HAVE_MUTED_s, peers[id].displayName), 'info');
}
else{
$.notify(locale.CANT_MUTE_OWNER, 'error');
}
} }
// Puase a peer // Puase a peer
function pausePeer(id){ function pausePeer(id){
if (peers[id] && peers[id].role != 'owner'){
webrtc.sendToAll('owner_pause', {peer: id}); webrtc.sendToAll('owner_pause', {peer: id});
$.notify(sprintf(locale.YOU_HAVE_SUSPENDED_s, peers[id].displayName), 'info');
}
else{
$.notify(locale.CANT_SUSPEND_OWNER, 'error');
}
} }
// Kick a peer // Kick a peer
function kickPeer(id){ function kickPeer(id){
if (peers[id] && peers[id].role != 'owner'){
webrtc.sendToAll('owner_kick', {peer: id}); webrtc.sendToAll('owner_kick', {peer: id});
// Wait a bit for the peer to leave, but end connection if it's still here // Wait a bit for the peer to leave, but end connection if it's still here
// after 2 seconds // after 2 seconds
@ -446,6 +465,11 @@ function initVroom(room) {
peers[id].obj.end(); peers[id].obj.end();
} }
}, 2000); }, 2000);
$.notify(sprintf(locale.YOU_HAVE_KICKED_s, peers[id].displayName), 'info');
}
else{
$.notify(locale.CANT_KICK_OWNER, 'error');
}
} }
// Mute our mic // Mute our mic
@ -475,7 +499,7 @@ function initVroom(room) {
if (peers[data.id].role != 'owner'){ if (peers[data.id].role != 'owner'){
return; return;
} }
if (data.payload.peer && data.payload.peer == peers.local.id){ if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){
// Ignore this if the remote peer isn't the owner of the room // Ignore this if the remote peer isn't the owner of the room
if (!peers.local.micMuted){ if (!peers.local.micMuted){
muteMic(); muteMic();
@ -484,7 +508,7 @@ function initVroom(room) {
$.notify(sprintf(locale.s_IS_MUTING_YOU, peers[data.id].displayName), 'info'); $.notify(sprintf(locale.s_IS_MUTING_YOU, peers[data.id].displayName), 'info');
} }
} }
else{ else if (data.payload.peer != peers.local.id){
$.notify(sprintf(locale.s_IS_MUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_MUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
} }
}); });
@ -493,7 +517,7 @@ function initVroom(room) {
if (peers[data.id].role != 'owner'){ if (peers[data.id].role != 'owner'){
return; return;
} }
if (data.payload.peer && data.payload.peer == peers.local.id){ if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){
if (!peers.local.paused){ if (!peers.local.paused){
suspendCam(); suspendCam();
$("#suspendCamLabel").addClass('btn-danger active'); $("#suspendCamLabel").addClass('btn-danger active');
@ -501,7 +525,7 @@ function initVroom(room) {
$.notify(sprintf(locale.s_IS_SUSPENDING_YOU, peers[data.id].displayName), 'info'); $.notify(sprintf(locale.s_IS_SUSPENDING_YOU, peers[data.id].displayName), 'info');
} }
} }
else{ else if (data.payload.peer != peers.local.id){
$.notify(sprintf(locale.s_IS_SUSPENDING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_SUSPENDING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
} }
}); });
@ -510,11 +534,11 @@ function initVroom(room) {
if (peers[data.id].role != 'owner'){ if (peers[data.id].role != 'owner'){
return; return;
} }
if (data.payload.peer && data.payload.peer == peers.local.id){ if (data.payload.peer && data.payload.peer == peers.local.id && peers.local.role != 'owner'){
hangupCall; hangupCall;
window.location.assign(rootUrl + 'kicked/' + roomName); window.location.assign(rootUrl + 'kicked/' + roomName);
} }
else{ else if (data.payload.peer != peers.local.id && peers[data.payload.peer] && peers[data.payload.peer].role != 'owner'){
$.notify(sprintf(locale.s_IS_KICKING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_KICKING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info');
// Wait a bit for the peer to leave, but end connection if it's still here // Wait a bit for the peer to leave, but end connection if it's still here
// after 2 seconds // after 2 seconds

Loading…
Cancel
Save