Add a global members limit

master
Daniel Berteaud 10 years ago
parent 00637aeee7
commit ea73a4009d
  1. 3
      conf/settings.ini.dist
  2. 1
      lib/Vroom/I18N/en.pm
  3. 1
      lib/Vroom/I18N/fr.pm
  4. 18
      vroom.pl

@ -54,6 +54,9 @@
;reserved_inactivity_timeout = '86400'
; A comma separated list of room names you don't want to be reservable
;common_names = 'test,test1,test123,0,1,2,3,4,5,6,7,8,9,123,1234,12345,a,aa,abc,azerty,qwerty,vroom,foo,bar,baz'
; A limit of member in any room. As trafic is really p2p, a high number of peers can make things slow
; or even crash browsers. You can set a limit to garantee a good user experience. Default is unlimited
;max_members = 0
[log]
; Verbosity of the web interface. Can be debug, info, warn, error or fatal

@ -17,6 +17,7 @@ our %Lexicon = (
"ERROR_NOT_LOGGED_IN" => "Sorry, your not logged in",
"ERROR_DB_UNAVAILABLE" => "The database is not available",
"ERROR_DB_VERSION_MISMATCH" => "The database must be updated",
"ERROR_TOO_MANY_MEMBERS" => "This room reached its members limit",
"JS_REQUIRED" => "VROOM needs javascript to work properly",
"EMAIL_INVITATION" => "Video conference invitation",
"INVITE_SENT_TO_s" => "An invitation was sent to the following addresses\n%s",

@ -19,6 +19,7 @@ our %Lexicon = (
"ERROR_NOT_LOGGED_IN" => "Désolé, vous n'êtes pas identifié",,
"ERROR_DB_UNAVAILABLE" => "La base de données n'est pas accessible",
"ERROR_DB_VERSION_MISMATCH" => "La base de donnée doit être mise à jour",
"ERROR_TOO_MANY_MEMBERS" => "Ce salon a atteint sa limite de participants",
"JS_REQUIRED" => "VROOM nécessite l'activation du javascript",
"EMAIL_INVITATION" => "Invitation à une conférence vidéo",
"YOU_ARE_INVITED_TO_A_MEETING" => "Vous êtes attendu sur un salon de vidéo conférence. " .

@ -50,6 +50,7 @@ $config->{'cookie.name'} ||= 'vroom';
$config->{'rooms.inactivity_timeout'} ||= 60;
$config->{'rooms.reserved_inactivity_timeout'} ||= 86400;
$config->{'rooms.common_names'} ||= '';
$config->{'rooms.max_members'} ||= 0;
$config->{'log.level'} ||= 'info';
$config->{'etherpad.uri'} ||= '';
$config->{'etherpad.api_key'} ||= '';
@ -919,6 +920,7 @@ helper signal_broadcast_room => sub {
# ecept the sender himself
foreach my $peer (keys %$peers){
next if ($peer eq $data->{from});
next if !$peers->{$data->{from}}->{room};
next if !$peers->{$peer}->{room};
next if $peers->{$peer}->{room} ne $peers->{$data->{from}}->{room};
$peers->{$peer}->{socket}->send($data->{msg});
@ -977,6 +979,14 @@ websocket '/socket.io/:ver/websocket/:id' => sub {
$self->finish;
return;
}
# Are we under the limit of members ?
elsif ($config->{'rooms.max_members'} > 0 && $self->get_room_members($room) >= $config->{'rooms.max_members'}){
$self->app->log->debug("Failed to connect to the signaling channel, members limit (" . $config->{'rooms.max_members'} .
") is reached");
$self->send( Protocol::SocketIO::Message->new( type => 'disconnect' ) );
$self->finish;
return;
}
# We build a list of peers, except this new one so we can send it
# to the new peer, and he'll be able to contact all those peers
my $others = {};
@ -1971,6 +1981,14 @@ get '/:room' => sub {
ownerPass => ($data->{owner_password}) ? '1':'0'
);
}
# If we've reached the members' limit
if ($config->{'rooms.max_members'} > 0 && $self->get_room_members($room) >= $config->{'rooms.max_members'}){
return $self->render('error',
msg => $self->l("ERROR_TOO_MANY_MEMBERS"),
err => 'ERROR_TOO_MANY_MEMBERS',
room => $room,
);
}
# Now, if the room is password protected and we're not a participant, nor the owner, lets prompt for the password
# Email invitation have a token which can be used instead of password
if ($data->{join_password} &&

Loading…
Cancel
Save