Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix: Do not allow visitors while lobby is enabled.
damencho22c6b72a7540
diff --git a/resources/prosody-plugins/mod_fmuc.lua b/resources/prosody-plugins/mod_fmuc.luaindex 89c9872cef..71ce95cd26 100644--- a/resources/prosody-plugins/mod_fmuc.lua+++ b/resources/prosody-plugins/mod_fmuc.lua@@ -52,11 +52,16 @@ end-- mark all occupants as visitorsmodule:hook('muc-occupant-pre-join', function (event)- local occupant, session = event.occupant, event.origin;+ local occupant, room, origin, stanza = event.occupant, event.room, event.origin, event.stanza;local node, host = jid.split(occupant.bare_jid);if host == local_domain then- occupant.role = 'visitor';+ if room._main_room_lobby_enabled then+ origin.send(st.error_reply(stanza, 'cancel', 'not-allowed', 'Visitors not allowed while lobby is on!'));+ return true;+ else+ occupant.role = 'visitor';+ endendend, 3);@@ -439,6 +444,12 @@ local function iq_from_main_handler(event)room:set_password(node.attr.password);room._data.meetingId = node.attr.meetingId;+ if node.attr.lobby == 'true' then+ room._main_room_lobby_enabled = true;+ elseif node.attr.lobby == 'false' then+ room._main_room_lobby_enabled = false;+ end+if fire_jicofo_unlock then-- everything is connected allow participants to joinmodule:fire_event('jicofo-unlock-room', { room = room; fmuc_fired = true; });diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.luaindex b3535d7cea..54105da0e0 100644--- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua+++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua@@ -334,11 +334,13 @@ process_host_module(main_muc_component_config, function(host_module, host)if members_only thenlocal lobby_created = attach_lobby_room(room, actor);if lobby_created then+ module:fire_event('jitsi-lobby-enabled', { room = room; });event.status_codes['104'] = true;notify_lobby_enabled(room, actor, true);endelseif room._data.lobbyroom thendestroy_lobby_room(room, room.jid);+ module:fire_event('jitsi-lobby-disabled', { room = room; });notify_lobby_enabled(room, actor, false);endend);diff --git a/resources/prosody-plugins/mod_visitors.lua b/resources/prosody-plugins/mod_visitors.luaindex 148be429e1..242567a830 100644--- a/resources/prosody-plugins/mod_visitors.lua+++ b/resources/prosody-plugins/mod_visitors.lua@@ -65,6 +65,7 @@ local function send_visitors_iq(conference_service, room, type)room = jid.join(jid.node(room.jid), conference_service) }):tag(type, { xmlns = 'jitsi:visitors',password = type ~= 'disconnect' and room:get_password() or '',+ lobby = room._data.lobbyroom and 'true' or 'false',meetingId = room._data.meetingId}):up();@@ -146,8 +147,6 @@ local function disconnect_vnode(event)local conference_service = muc_domain_prefix..'.'..vnode..'.meet.jitsi';- -- we are counting vnode main participants and we should be clearing it there- -- let's do it here just in casevisitors_nodes[room.jid].nodes[conference_service] = nil;send_visitors_iq(conference_service, room, 'disconnect');@@ -338,5 +337,26 @@ process_host_module(main_muc_component_config, function(host_module, host)endendend-end, -100); -- we want to run last in order to check is the status code 104+ end, -100); -- we want to run last in order to check is the status code 104+end);++module:hook('jitsi-lobby-enabled', function(event)+ local room = event.room;+ if visitors_nodes[room.jid] then+ -- we need to update all vnodes+ local vnodes = visitors_nodes[room.jid].nodes;+ for conference_service in pairs(vnodes) do+ send_visitors_iq(conference_service, room, 'update');+ end+ end+end);+module:hook('jitsi-lobby-disabled', function(event)+local room = event.room;+ if visitors_nodes[room.jid] then+ -- we need to update all vnodes+ local vnodes = visitors_nodes[room.jid].nodes;+ for conference_service in pairs(vnodes) do+ send_visitors_iq(conference_service, room, 'update');+ end+ endend);