* feat: Stores vpaas check in room object.

* feat: Clear queues on destroy for muc rate limit join/leave.

* feat: Stores vpaas check in room object.

* squash: Replace one regexp with starts_with.
pull/14270/head stable/jitsi-meet_9220
Дамян Минков 1 year ago committed by GitHub
parent 95ad04b19c
commit 5871e50a20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      doc/jaas/move-to-jaas.sh
  2. 4
      resources/prosody-plugins/mod_fmuc.lua
  3. 9
      resources/prosody-plugins/mod_muc_rate_limit.lua
  4. 4
      resources/prosody-plugins/mod_visitors_component.lua
  5. 32
      resources/prosody-plugins/util.lib.lua

@ -38,9 +38,9 @@ apt install token-generator
mkdir -p /etc/jitsi/meet/jaas
VPASS_COOKIE=$(echo -n ${JAAS_KEY_ID}| cut -d/ -f1)
VPAAS_COOKIE=$(echo -n ${JAAS_KEY_ID}| cut -d/ -f1)
cp /usr/share/jitsi-meet-web-config/nginx-jaas.conf /etc/jitsi/meet/jaas
sed -i "s/jaas_magic_cookie/${VPASS_COOKIE}/g" /etc/jitsi/meet/jaas/nginx-jaas.conf
sed -i "s/jaas_magic_cookie/${VPAAS_COOKIE}/g" /etc/jitsi/meet/jaas/nginx-jaas.conf
cp /usr/share/jitsi-meet-web-config/8x8.vc-config.js /etc/jitsi/meet/jaas/
echo "set \$config_js_location /etc/jitsi/meet/jaas/8x8.vc-config.js;" >> /etc/jitsi/meet/jaas/jaas-vars

@ -193,8 +193,8 @@ module:hook('muc-broadcast-presence', function (event)
local session = sessions[occupant.jid];
local identity = session and session.jitsi_meet_context_user;
if is_vpaas(room.jid) and identity then
-- in case of moderator in vpass meeting we want to do auto-promotion
if is_vpaas(room) and identity then
-- in case of moderator in vpaas meeting we want to do auto-promotion
local is_vpaas_moderator = identity.moderator;
if is_vpaas_moderator == 'true' or is_vpaas_moderator == true then
is_moderator = true;

@ -57,7 +57,7 @@ end
-- process join_rate_presence_queue in the room and pops element passing them to handle_normal_presence
-- returns 1 if we want to reschedule it after 1 second
local function timer_process_queue_elements (rate, queue, process, queue_empty_cb)
if not queue or queue:count() == 0 then
if not queue or queue:count() == 0 or queue.empty then
return;
end
@ -152,7 +152,12 @@ end, 9); -- as we will rate limit joins we need to be the first to execute
-- clear queue on room destroy so timer will skip next run if any
module:hook('muc-room-destroyed',function(event)
event.room.join_rate_presence_queue = nil;
if event.room.join_rate_presence_queue then
event.room.join_rate_presence_queue.empty = true;
end
if event.room.leave_rate_presence_queue then
event.room.leave_rate_presence_queue.empty = true;
end
end);
module:hook('muc-occupant-pre-leave', function (event)

@ -216,8 +216,8 @@ local function stanza_handler(event)
end
local force_promote = request_promotion.attr.forcePromote;
if force_promote == 'true' and not is_vpaas(room.jid) then
module:log('warn', 'Received promotion request for non vpass room (%s) with forced promotion: ',
if force_promote == 'true' and not is_vpaas(room) then
module:log('warn', 'Received promotion request for non vpaas room (%s) with forced promotion: ',
room.jid, stanza);
return true; -- stop processing
end

@ -416,25 +416,35 @@ function is_moderated(room_jid)
return false;
end
-- check if the room tenant starts with
-- vpaas-magic-cookie-
function is_vpaas(room_jid)
local node, host = jid.split(room_jid);
-- check if the room tenant starts with vpaas-magic-cookie-
-- @param room the room to check
function is_vpaas(room)
if not room then
return false;
end
-- stored check in room object if it exist
if room.is_vpaas ~= nil then
return room.is_vpaas;
end
room.is_vpaas = false;
local node, host = jid.split(room.jid);
if host ~= muc_domain or not node then
module:log('debug', 'Not the same host');
return false;
end
local tenant, conference_name = node:match('^%[([^%]]+)%](.+)$');
if not (tenant and conference_name) then
module:log('debug', 'Not a vpaas room %s', room_jid);
return false;
end
local vpaas_prefix, _ = tenant:match('^(vpaas%-magic%-cookie%-)(.*)$')
if vpaas_prefix ~= 'vpaas-magic-cookie-' then
module:log('debug', 'Not a vpaas room %s', room_jid);
return false
if not starts_with(tenant, 'vpaas-magic-cookie-') then
return false;
end
return true
room.is_vpaas = true;
return true;
end
return {

Loading…
Cancel
Save