Revert "Remove room lock, not that usefull now that you can use a password"

This reverts commit 25f2602694.

Locking can still be usefull to prevent participant to join, event is they know the pass

Conflicts:
	public/js/vroom.js
master
Daniel Berteaud 11 years ago
parent e4ce4b9678
commit 43f3fba40b
  1. 4
      lib/Vroom/I18N/en.pm
  2. 4
      lib/Vroom/I18N/fr.pm
  3. 38
      public/js/vroom.js
  4. 29
      public/vroom.pl
  5. 16
      templates/default/join.html.ep

@ -32,7 +32,11 @@ our %Lexicon = (
"FROM" => "From", "FROM" => "From",
"GIVE_US_YOUR_FEEDBACK" => "Give us your feedback", "GIVE_US_YOUR_FEEDBACK" => "Give us your feedback",
"YOUR_FEEDBACK_HELPS_US" => "Your feedback (good or bad) can help us improve this application", "YOUR_FEEDBACK_HELPS_US" => "Your feedback (good or bad) can help us improve this application",
"ROOM_LOCKED" => "This room is now locked",
"ROOM_UNLOCKED" => "This room is now unlocked",
"ONE_OF_THE_PEERS" => "one of the peers", "ONE_OF_THE_PEERS" => "one of the peers",
"ROOM_LOCKED_BY_s" => "%s locked the room",
"ROOM_UNLOCKED_BY_s" => "%s unlocked the room",
"PASSWORD_PROTECT_ON_BY_s" => "%s password protected the room", "PASSWORD_PROTECT_ON_BY_s" => "%s password protected the room",
"PASSWORD_PROTECT_OFF_BY_s" => "%s removed password protection", "PASSWORD_PROTECT_OFF_BY_s" => "%s removed password protection",
"OWNER_PASSWORD_CHANGED_BY_s" => "%s changed the room manager password", "OWNER_PASSWORD_CHANGED_BY_s" => "%s changed the room manager password",

@ -35,7 +35,11 @@ our %Lexicon = (
"GIVE_US_YOUR_FEEDBACK" => "Parlez-nous de votre expérience", "GIVE_US_YOUR_FEEDBACK" => "Parlez-nous de votre expérience",
"YOUR_FEEDBACK_HELPS_US" => "Votre retour d'expérience (bonne ou mauvaise) peut nous aider à améliorer cette application", "YOUR_FEEDBACK_HELPS_US" => "Votre retour d'expérience (bonne ou mauvaise) peut nous aider à améliorer cette application",
"INVITE_SENT_TO_s" => "Une invitation a été envoyée à %s", "INVITE_SENT_TO_s" => "Une invitation a été envoyée à %s",
"ROOM_LOCKED" => "Ce salon est maintenant verrouillé",
"ROOM_UNLOCKED" => "Ce salon est maintenant déverrouillé",
"ONE_OF_THE_PEERS" => "un des participants", "ONE_OF_THE_PEERS" => "un des participants",
"ROOM_LOCKED_BY_s" => "%s a verrouillé le salon",
"ROOM_UNLOCKED_BY_s" => "%s a déverrouillé le salon",
"PASSWORD_PROTECT_ON_BY_s" => "%s a protégé le salon par un mot de passe", "PASSWORD_PROTECT_ON_BY_s" => "%s a protégé le salon par un mot de passe",
"PASSWORD_PROTECT_OFF_BY_s" => "%s a supprimé la protection par mot de passe", "PASSWORD_PROTECT_OFF_BY_s" => "%s a supprimé la protection par mot de passe",
"OWNER_PASSWORD_CHANGED_BY_s" => "%s a modifié le mot de passe du gestionnaire du salon", "OWNER_PASSWORD_CHANGED_BY_s" => "%s a modifié le mot de passe du gestionnaire du salon",

@ -25,6 +25,8 @@ var locale = {
CAM_RESUMED: '', CAM_RESUMED: '',
SET_YOUR_NAME_TO_CHAT: '', SET_YOUR_NAME_TO_CHAT: '',
ONE_OF_THE_PEERS: '', ONE_OF_THE_PEERS: '',
ROOM_LOCKED_BY_s: '',
ROOM_UNLOCKED_BY_s: '',
PASSWORD_PROTECT_ON_BY_s: '', PASSWORD_PROTECT_ON_BY_s: '',
PASSWORD_PROTECT_OFF_BY_s: '', PASSWORD_PROTECT_OFF_BY_s: '',
OWNER_PASSWORD_CHANGED_BY_s: '', OWNER_PASSWORD_CHANGED_BY_s: '',
@ -446,7 +448,15 @@ function initVroom(room) {
$(el).remove(); $(el).remove();
}); });
// A few notif on password set/unset // A few notif on password set/unset or lock/unlock
webrtc.on('room_locked', function(data){
$('#lockLabel').addClass('btn-danger active');
$.notify(sprintf(locale.ROOM_LOCKED_BY_s, stringEscape(peers[data.id].displayName)), 'info');
});
webrtc.on('room_unlocked', function(data){
$('#lockLabel').removeClass('btn-danger active');
$.notify(sprintf(locale.ROOM_UNLOCKED_BY_s, stringEscape(peers[data.id].displayName)), 'info');
});
webrtc.on('password_protect_on', function(data){ webrtc.on('password_protect_on', function(data){
$.notify(sprintf(locale.PASSWORD_PROTECT_ON_BY_s, stringEscape(peers[data.id].displayName)), 'info'); $.notify(sprintf(locale.PASSWORD_PROTECT_ON_BY_s, stringEscape(peers[data.id].displayName)), 'info');
}); });
@ -561,6 +571,32 @@ function initVroom(room) {
webrtc.sendDirectlyToAll('vroom', 'setDisplayName', $('#displayName').val()); webrtc.sendDirectlyToAll('vroom', 'setDisplayName', $('#displayName').val());
}); });
// Handle room lock/unlock
$('#lockButton').change(function() {
var action = ($(this).is(":checked")) ? 'lock':'unlock';
$.ajax({
data: {
action: action,
room: roomName
},
error: function(data) {
var msg = (data && data.msg) ? data.msg : locale.ERROR_OCCURED;
$.notify(msg, 'error');
},
success: function(data) {
$.notify(data.msg, 'info');
if (action === 'lock'){
$("#lockLabel").addClass('btn-danger');
webrtc.sendToAll('room_locked', {});
}
else{
$("#lockLabel").removeClass('btn-danger');
webrtc.sendToAll('room_unlocked', {});
}
}
});
});
// ScreenSharing // ScreenSharing
$('#shareScreenButton').change(function() { $('#shareScreenButton').change(function() {
var action = ($(this).is(":checked")) ? 'share':'unshare'; var action = ($(this).is(":checked")) ? 'share':'unshare';

@ -451,7 +451,8 @@ get '/(*room)' => sub {
room => $room room => $room
); );
} }
$self->stash(turnPassword => $data->{token}); $self->stash(locked => $data->{locked} ? 'checked':'',
turnPassword => $data->{token});
$self->render('join'); $self->render('join');
}; };
@ -504,6 +505,32 @@ post '/action' => sub {
} }
); );
} }
if ($action =~ m/(un)?lock/){
my ($lock,$success);
if ($action eq 'lock'){
$lock = 1;
$success = $self->l('ROOM_LOCKED');
}
else{
$lock = 0;
$success = $self->l('ROOM_UNLOCKED');
}
my $room = $self->param('room');
my $res = $self->lock_room($room,$lock);
unless ($res){
return $self->render(
json => {
msg => $self->l('ERROR_OCCURED'),
},
status => '500'
);
}
return $self->render(
json => {
msg => $success,
}
);
}
elsif ($action eq 'ping'){ elsif ($action eq 'ping'){
my $res = $self->ping_room($room); my $res = $self->ping_room($room);
# Cleanup expired rooms every ~10 pings # Cleanup expired rooms every ~10 pings

@ -159,6 +159,22 @@
</div> </div>
</form> </form>
</li> </li>
<li class="divider"></li>
<li>
<li>
<div class="navbar-form">
<center>
<p><%=l 'PREVENT_TO_JOIN' %></p>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default<%= $locked eq 'checked' ? ' btn-danger active':'' %> help" id="lockLabel" data-toggle="tooltip" data-placement="bottom" title="<%=l 'PREVENT_TO_JOIN' %>">
<input type="checkbox" id="lockButton" <%= $locked %>>
<span class="glyphicon glyphicon-lock">
</span>
</label>
</div>
</center>
</div>
</li>
</ul> </ul>
</div> </div>
<div class="btn-group navbar-form navbar-right" data-toggle="buttons" > <div class="btn-group navbar-form navbar-right" data-toggle="buttons" >

Loading…
Cancel
Save