Skip to content

Commit

Permalink
feat: Stores vpaas check in room object.
Browse files Browse the repository at this point in the history
  • Loading branch information
damencho committed Jan 19, 2024
1 parent b6097b8 commit 09b425f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
4 changes: 2 additions & 2 deletions doc/jaas/move-to-jaas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions resources/prosody-plugins/mod_fmuc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions resources/prosody-plugins/mod_visitors_component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 19 additions & 9 deletions resources/prosody-plugins/util.lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
return false;
end
return true

room.is_vpaas = true;
return true;
end

return {
Expand Down

0 comments on commit 09b425f

Please sign in to comment.