Selaa lähdekoodia

* 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.
factor2
Дамян Минков 1 vuosi sitten
vanhempi
commit
5871e50a20
No account linked to committer's email address

+ 2
- 2
doc/jaas/move-to-jaas.sh Näytä tiedosto

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

+ 2
- 2
resources/prosody-plugins/mod_fmuc.lua Näytä tiedosto

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

+ 7
- 2
resources/prosody-plugins/mod_muc_rate_limit.lua Näytä tiedosto

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

+ 2
- 2
resources/prosody-plugins/mod_visitors_component.lua Näytä tiedosto

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

+ 21
- 9
resources/prosody-plugins/util.lib.lua Näytä tiedosto

@@ -416,25 +416,35 @@ function is_moderated(room_jid)
416 416
     return false;
417 417
 end
418 418
 
419
-function is_vpaas(room_jid)
420
-    local node, host = jid.split(room_jid);
419
+-- check if the room tenant starts with vpaas-magic-cookie-
420
+-- @param room the room to check
421
+function is_vpaas(room)
422
+    if not room then
423
+        return false;
424
+    end
425
+
426
+    -- stored check in room object if it exist
427
+    if room.is_vpaas ~= nil then
428
+        return room.is_vpaas;
429
+    end
430
+
431
+    room.is_vpaas = false;
432
+
433
+    local node, host = jid.split(room.jid);
421 434
     if host ~= muc_domain or not node then
422
-        module:log('debug', 'Not the same host');
423 435
         return false;
424 436
     end
425 437
     local tenant, conference_name = node:match('^%[([^%]]+)%](.+)$');
426 438
     if not (tenant and conference_name) then
427
-        module:log('debug', 'Not a vpaas room %s', room_jid);
428 439
         return false;
429 440
     end
430
-    local vpaas_prefix, _ = tenant:match('^(vpaas%-magic%-cookie%-)(.*)$')
431
-    if vpaas_prefix ~= 'vpaas-magic-cookie-' then
432
-        module:log('debug', 'Not a vpaas room %s', room_jid);
433
-        return false
441
+
442
+    if not starts_with(tenant, 'vpaas-magic-cookie-') then
443
+        return false;
434 444
     end
435
-    return true
445
+
446
+    room.is_vpaas = true;
447
+    return true;
436 448
 end
437 449
 
438 450
 return {

Loading…
Peruuta
Tallenna