diff --git a/conf/settings.ini.dist b/conf/settings.ini.dist index 5379bda..d9ad5f6 100644 --- a/conf/settings.ini.dist +++ b/conf/settings.ini.dist @@ -55,7 +55,8 @@ ; 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 +; or even crash browsers. You can set a limit to garantee a good user experience. 0 (default value) means unlimited +; This is the upper limit, you can set a different limit per room ;max_members = 0 [log] diff --git a/docs/database/schema.mysql b/docs/database/schema.mysql index 0dbff85..9fd5a2c 100644 --- a/docs/database/schema.mysql +++ b/docs/database/schema.mysql @@ -22,6 +22,7 @@ CREATE TABLE `rooms` ( `token` VARCHAR(160) NOT NULL, `realm` VARCHAR(160) DEFAULT NULL, `persistent` TINYINT UNSIGNED DEFAULT '0', + `max_members` TINYINT UNSIGNED DEFAULT '0', PRIMARY KEY (`id`), UNIQUE (`name`), INDEX (`last_activity`) diff --git a/lib/Vroom/Constants.pm b/lib/Vroom/Constants.pm index 6f590eb..e59a43d 100644 --- a/lib/Vroom/Constants.pm +++ b/lib/Vroom/Constants.pm @@ -7,7 +7,7 @@ use base 'Exporter'; our @EXPORT = qw/DB_VERSION COMPONENTS MOH JS_STRINGS API_ACTIONS/; # Database version -use constant DB_VERSION => 3; +use constant DB_VERSION => 4; # Components used to generate the credits part use constant COMPONENTS => { diff --git a/lib/Vroom/I18N/en.pm b/lib/Vroom/I18N/en.pm index de06e2a..9ef4c29 100644 --- a/lib/Vroom/I18N/en.pm +++ b/lib/Vroom/I18N/en.pm @@ -143,6 +143,7 @@ our %Lexicon = ( "JOIN_PASSWORD" => "Password to join the room", "OWNER_PASSWORD" => "Password to manage the room", "PERSISTENT" => "Persistent", + "MAX_MEMBERS" => "Participants limit", "TOOLTIP_LOCK_ROOM" => "Once this option is enabled, no one else can join the room. " . "Only enable it after every participant is here. This way, nobody will be able to disturb " . "your meeting", @@ -151,6 +152,8 @@ our %Lexicon = ( "TOOLTIP_RESERVE_THIS_ROOM" => "If this password is set, you'll be able to access the configuration menus ". "next time you connect", "TOOLTIP_PERSISTENT" => "The room will be persistent (kept forever)", + "TOOLTIP_MAX_MEMBERS" => "Define the upper limit of connected peer in the room. A value of 0 means no limit. " . + "(Note that an admin might define a limit anyway)", "TOOLTIP_NOTIFICATION_ON_JOIN" => "One or more email addresse(s) which will be notified when someone joins the room", "ROOM_NOW_PERSISTENT" => "This room is now persistent", "ROOM_NO_MORE_PERSISTENT" => "This rooms isn't persistent anymore", diff --git a/lib/Vroom/I18N/fr.pm b/lib/Vroom/I18N/fr.pm index 1a33f34..ad4de3c 100644 --- a/lib/Vroom/I18N/fr.pm +++ b/lib/Vroom/I18N/fr.pm @@ -149,6 +149,7 @@ our %Lexicon = ( "JOIN_PASSWORD" => "Mot de passe d'accès au salon", "OWNER_PASSWORD" => "Mot de passe de gestionnaire", "PERSISTENT" => "Persistant", + "MAX_MEMBERS" => "Limite de participants", "TOOLTIP_LOCK_ROOM" => "Une fois cette option activée, plus personne ne peut rejoindre le salon. " . "À n'activer qu'une fois que tout les participants vous ont rejoint, pour éviter " . "que d'autres personnes viennent troubler la réunion", @@ -157,6 +158,8 @@ our %Lexicon = ( "TOOLTIP_RESERVE_THIS_ROOM" => "Ce mot de passe vous permettra de récuperer l'accès aux " . "menus de gestion la prochaine fois que vous vous connecterez", "TOOLTIP_PERSISTENT" => "Rend le salon persistant (sera conservé indéfiniement)", + "TOOLTIP_MAX_MEMBERS" => "Défini le nombre maximal de participants pouvant rejoindre le salon en même temps. Une valeur de 0" . + "supprime toute limite. (Notez qu'une valeur maximale peut être définie par un administrateur)", "TOOLTIP_NOTIFICATION_ON_JOIN" => "Une ou plusieurs adresses email qui recevront une notification dès que quulqu'un rejoint ce salon", "ROOM_NOW_PERSISTENT" => "Ce salon est maintenant persistant", "ROOM_NO_MORE_PERSISTENT" => "Ce salon n'est plus persistant", diff --git a/public/js/vroom.js b/public/js/vroom.js index 951744c..a751c8d 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -300,6 +300,8 @@ $('#configureRoomForm').submit(function(e){ $('#ownerPass').val() : false, persist = ($('#persistentSet').length > 0) ? $('#persistentSet').bootstrapSwitch('state') : '', + members = ($('#maxMembers').length > 0) ? + $('#maxMembers').val() : 0, emails = []; $('input[name="emails[]"]').each(function(){ emails.push($(this).val()); @@ -315,6 +317,7 @@ $('#configureRoomForm').submit(function(e){ join_password: joinPass, owner_password: ownerPass, persistent: persist, + max_members: members, emails: emails } }) @@ -528,6 +531,7 @@ function initAdminRooms(){ $('#joinPassSet').bootstrapSwitch('state', data.join_auth == 'yes'); $('#ownerPassSet').bootstrapSwitch('state', data.owner_auth == 'yes'); $('#persistentSet').bootstrapSwitch('state', data.persistent == 'yes'); + $('#maxMembers').val(data.max_members); // Hide the password inputs $('#joinPassFields,#ownerPassFields').hide(); // And display the config modal dialog diff --git a/scripts/db_upgrade.pl b/scripts/db_upgrade.pl index aba4ff4..6cf28e9 100644 --- a/scripts/db_upgrade.pl +++ b/scripts/db_upgrade.pl @@ -91,3 +91,20 @@ if ($cur_ver < 3){ }; print "Successfully upgraded to schema version 3\n"; } + +if ($cur_ver < 4){ + print "Upgrading the schema to version 4\n"; + eval { + $dbh->begin_work; + $dbh->do(qq{ ALTER TABLE `rooms` ADD COLUMN `max_members` TINYINT UNSIGNED DEFAULT '0' AFTER `persistent` }); + $dbh->do(qq{ UPDATE `config` SET `value`='4' WHERE `key`='schema_version' }); + $dbh->commit; + }; + if ($@){ + print "An error occurred: " . $dbh->errstr . "\n"; + local $dbh->{RaiseError} = 0; + $dbh->rollback; + exit 255; + }; + print "Successfully upgraded to schema version 4\n"; +} diff --git a/templates/default/configure_modal.html.ep b/templates/default/configure_modal.html.ep index 2b6d5ee..9348302 100644 --- a/templates/default/configure_modal.html.ep +++ b/templates/default/configure_modal.html.ep @@ -105,6 +105,23 @@ +