Don't display cryptic peer ID

When the participant hasn't set a display name
master
Daniel Berteaud 11 years ago
parent 07276cbd86
commit 513fd90d47
  1. 2
      lib/Vroom/I18N/en.pm
  2. 2
      lib/Vroom/I18N/fr.pm
  3. 40
      public/js/vroom.js

@ -131,6 +131,8 @@ our %Lexicon = (
"CANT_SUSPEND_OWNER" => "You can't suspend this participant'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", "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", "CANT_KICK_OWNER" => "You can't kick this participant out of the room",
"A_ROOM_ADMIN" => "a room administrator",
"A_PARTICIPANT" => "a participant",
"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",

@ -139,6 +139,8 @@ our %Lexicon = (
"CANT_SUSPEND_OWNER" => "Vous ne pouvez pas mettre la webcam de ce participant 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", "YOU_HAVE_KICKED_s" => "Vous avez bani %s du salon",
"CANT_KICK_OWNER" => "Vous ne pouvez pas bannir ce participant", "CANT_KICK_OWNER" => "Vous ne pouvez pas bannir ce participant",
"A_ROOM_ADMIN" => "un administrateur du salon",
"A_PARTICIPANT" => "un 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",

@ -4,7 +4,6 @@ released under the MIT licence
Copyright 2014 Firewall Services Copyright 2014 Firewall Services
*/ */
// Default notifications // Default notifications
$.notify.defaults( { globalPosition: 'bottom left' } ); $.notify.defaults( { globalPosition: 'bottom left' } );
// Enable tooltip on required elements // Enable tooltip on required elements
@ -57,7 +56,9 @@ var locale = {
YOU_HAVE_KICKED_s: '', YOU_HAVE_KICKED_s: '',
CANT_KICK_OWNER: '', CANT_KICK_OWNER: '',
REMOVE_THIS_ADDRESS: '', REMOVE_THIS_ADDRESS: '',
DISPLAY_NAME_REQUIRED: '' DISPLAY_NAME_REQUIRED: '',
A_ROOM_ADMIN: '',
A_PARTICIPANT: ''
}; };
// Localize the strings we need // Localize the strings we need
@ -562,12 +563,13 @@ function initVroom(room) {
function mutePeer(id){ function mutePeer(id){
if (peers[id] && peers[id].role != 'owner'){ if (peers[id] && peers[id].role != 'owner'){
var msg = locale.YOU_HAVE_MUTED_s; var msg = locale.YOU_HAVE_MUTED_s;
var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT;
if (peers[id].micMuted){ if (peers[id].micMuted){
msg = locale.YOU_HAVE_UNMUTED_s msg = locale.YOU_HAVE_UNMUTED_s
} }
// notify everyone that we have muted this peer // notify everyone that we have muted this peer
webrtc.sendToAll('owner_toggle_mute', {peer: id}); webrtc.sendToAll('owner_toggle_mute', {peer: id});
$.notify(sprintf(msg, peers[id].displayName), 'info'); $.notify(sprintf(msg, who), 'info');
} }
// We cannot mute another owner // We cannot mute another owner
else{ else{
@ -578,11 +580,12 @@ function initVroom(room) {
function pausePeer(id){ function pausePeer(id){
if (peers[id] && peers[id].role != 'owner'){ if (peers[id] && peers[id].role != 'owner'){
var msg = locale.YOU_HAVE_SUSPENDED_s; var msg = locale.YOU_HAVE_SUSPENDED_s;
var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT;
if (peers[id].videoPaused){ if (peers[id].videoPaused){
msg = locale.YOU_HAVE_RESUMED_s; msg = locale.YOU_HAVE_RESUMED_s;
} }
webrtc.sendToAll('owner_toggle_pause', {peer: id}); webrtc.sendToAll('owner_toggle_pause', {peer: id});
$.notify(sprintf(msg, peers[id].displayName), 'info'); $.notify(sprintf(msg, who), 'info');
} }
else{ else{
$.notify(locale.CANT_SUSPEND_OWNER, 'error'); $.notify(locale.CANT_SUSPEND_OWNER, 'error');
@ -599,7 +602,8 @@ function initVroom(room) {
peers[id].obj.end(); peers[id].obj.end();
} }
}, 2000); }, 2000);
$.notify(sprintf(locale.YOU_HAVE_KICKED_s, peers[id].displayName), 'info'); var who = (peers[id].hasName) ? peers[id].displayName : locale.A_PARTICIPANT;
$.notify(sprintf(locale.YOU_HAVE_KICKED_s, who), 'info');
} }
else{ else{
$.notify(locale.CANT_KICK_OWNER, 'error'); $.notify(locale.CANT_KICK_OWNER, 'error');
@ -651,26 +655,29 @@ function initVroom(room) {
// We are the one being (un)muted, and we're not owner // We are the one being (un)muted, and we're not owner
// Be nice and obey // Be nice and obey
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 : locale.A_ROOM_ADMIN;
if (!peers.local.micMuted){ if (!peers.local.micMuted){
muteMic(); muteMic();
$('#muteMicLabel').addClass('btn-danger active'); $('#muteMicLabel').addClass('btn-danger active');
$('#muteMicButton').prop('checked', true); $('#muteMicButton').prop('checked', true);
$.notify(sprintf(locale.s_IS_MUTING_YOU, peers[data.id].displayName), 'info'); $.notify(sprintf(locale.s_IS_MUTING_YOU, who), 'info');
} }
else { else {
unmuteMic(); unmuteMic();
$('#muteMicLabel').removeClass('btn-danger active'); $('#muteMicLabel').removeClass('btn-danger active');
$('#muteMicButton').prop('checked', false); $('#muteMicButton').prop('checked', false);
$.notify(sprintf(locale.s_IS_UNMUTING_YOU, peers[data.id].displayName), 'info'); $.notify(sprintf(locale.s_IS_UNMUTING_YOU, who), 'info');
} }
} }
// It's another peer of the room // It's another peer of the room
else if (data.payload.peer != peers.local.id && peers[data.payload.peer]){ else if (data.payload.peer != peers.local.id && peers[data.payload.peer]){
var who = (peers[data.id].hasName) ? peers[data.id].displayName : locale.A_ROOM_ADMIN;
var target = (peers[data.payload.peer].hasName) ? peers[data.payload.peer].displayName : locale.A_PARTICIPANT;
if (peers[data.payload.peer].micMuted){ if (peers[data.payload.peer].micMuted){
$.notify(sprintf(locale.s_IS_UNMUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_UNMUTING_s, peers[data.id].who, target), 'info');
} }
else{ else{
$.notify(sprintf(locale.s_IS_MUTING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_MUTING_s, who, target), 'info');
} }
} }
}); });
@ -681,25 +688,28 @@ function initVroom(room) {
return; return;
} }
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 : locale.A_ROOM_ADMIN;
if (!peers.local.videoPaused){ if (!peers.local.videoPaused){
suspendCam(); suspendCam();
$('#suspendCamLabel').addClass('btn-danger active'); $('#suspendCamLabel').addClass('btn-danger active');
$('#suspendCamButton').prop('checked', true); $('#suspendCamButton').prop('checked', true);
$.notify(sprintf(locale.s_IS_SUSPENDING_YOU, peers[data.id].displayName), 'info'); $.notify(sprintf(locale.s_IS_SUSPENDING_YOU, who), 'info');
} }
else{ else{
resumeCam(); resumeCam();
$('#suspendCamLabel').removeClass('btn-danger active'); $('#suspendCamLabel').removeClass('btn-danger active');
$('#suspendCamButton').prop('checked', false); $('#suspendCamButton').prop('checked', false);
$.notify(sprintf(locale.s_IS_RESUMING_YOU, peers[data.id].displayName), 'info'); $.notify(sprintf(locale.s_IS_RESUMING_YOU, who), 'info');
} }
} }
else if (data.payload.peer != peers.local.id && peers[data.payload.peer]){ else if (data.payload.peer != peers.local.id && peers[data.payload.peer]){
var who = (peers[data.id].hasName) ? peers[data.id].displayName : locale.A_ROOM_ADMIN;
var target = (peers[data.payload.peer].hasName) ? peers[data.payload.peer].displayName : locale.A_PARTICIPANT;
if (peers[data.payload.peer].videoPaused){ if (peers[data.payload.peer].videoPaused){
$.notify(sprintf(locale.s_IS_RESUMING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_RESUMING_s, who, target), 'info');
} }
else{ else{
$.notify(sprintf(locale.s_IS_SUSPENDING_s, peers[data.id].displayName, peers[data.payload.peer].displayName), 'info'); $.notify(sprintf(locale.s_IS_SUSPENDING_s, who, target), 'info');
} }
} }
}); });
@ -713,7 +723,9 @@ function initVroom(room) {
window.location.assign(rootUrl + 'kicked/' + roomName); window.location.assign(rootUrl + 'kicked/' + roomName);
} }
else if (data.payload.peer != peers.local.id && peers[data.payload.peer] && peers[data.payload.peer].role != 'owner'){ 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'); var who = (peers[data.id].hasName) ? peers[data.id].displayName : locale.A_ROOM_ADMIN;
var target = (peers[data.payload.peer].hasName) ? peers[data.payload.peer].displayName : locale.A_PARTICIPANT;
$.notify(sprintf(locale.s_IS_KICKING_s, who, target), '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
setTimeout(function(){ setTimeout(function(){

Loading…
Cancel
Save