mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
feat: Reads region from http headers and set it in presence. (#15531)
* feat: Reads region from http headers and set it in presence. * chore(deps) lib-jitsi-meet@latest https://github.com/jitsi/lib-jitsi-meet/compare/v1906.0.0+dfc23df4...v1907.0.0+0d3304b7
This commit is contained in:
10
package-lock.json
generated
10
package-lock.json
generated
@@ -62,7 +62,7 @@
|
||||
"js-md5": "0.6.1",
|
||||
"js-sha512": "0.8.0",
|
||||
"jwt-decode": "2.2.0",
|
||||
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
|
||||
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
|
||||
"lodash-es": "4.17.21",
|
||||
"moment": "2.29.4",
|
||||
"moment-duration-format": "2.2.2",
|
||||
@@ -16954,8 +16954,8 @@
|
||||
},
|
||||
"node_modules/lib-jitsi-meet": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
|
||||
"integrity": "sha512-4w+/VkFNzj6rnbogfF6JHgL48pxo/Pq4GX6RXodnUGJMwu1Zc+nGw3SR/KJYqtxCfO9hAb+NBZVQfQvN16xRxg==",
|
||||
"resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
|
||||
"integrity": "sha512-qll80OJZol+xlDt3n58SqGPYQPer72C28XE9lSEtfOx6XdFdhLYXSzaNpPY4OP2tFjJqNX+Y2ZQkSkARGSqVrg==",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
@@ -37739,8 +37739,8 @@
|
||||
}
|
||||
},
|
||||
"lib-jitsi-meet": {
|
||||
"version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
|
||||
"integrity": "sha512-4w+/VkFNzj6rnbogfF6JHgL48pxo/Pq4GX6RXodnUGJMwu1Zc+nGw3SR/KJYqtxCfO9hAb+NBZVQfQvN16xRxg==",
|
||||
"version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
|
||||
"integrity": "sha512-qll80OJZol+xlDt3n58SqGPYQPer72C28XE9lSEtfOx6XdFdhLYXSzaNpPY4OP2tFjJqNX+Y2ZQkSkARGSqVrg==",
|
||||
"requires": {
|
||||
"@jitsi/js-utils": "2.2.1",
|
||||
"@jitsi/logger": "2.0.2",
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
"js-md5": "0.6.1",
|
||||
"js-sha512": "0.8.0",
|
||||
"jwt-decode": "2.2.0",
|
||||
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
|
||||
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
|
||||
"lodash-es": "4.17.21",
|
||||
"moment": "2.29.4",
|
||||
"moment-duration-format": "2.2.2",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
module:set_global();
|
||||
|
||||
local formdecode = require "util.http".formdecode;
|
||||
local region_header_name = module:get_option_string('region_header_name', 'x_proxy_region');
|
||||
|
||||
-- Extract the following parameters from the URL and set them in the session:
|
||||
-- * previd: for session resumption
|
||||
@@ -24,6 +25,8 @@ function init_session(event)
|
||||
session.jitsi_web_query_room = params.room;
|
||||
session.jitsi_web_query_prefix = params.prefix or "";
|
||||
end
|
||||
|
||||
session.user_region = request.headers[region_header_name];
|
||||
end
|
||||
|
||||
module:hook_global("bosh-session", init_session, 1);
|
||||
|
||||
@@ -75,17 +75,35 @@ module:hook('muc-broadcast-presence', function (event)
|
||||
end
|
||||
end);
|
||||
|
||||
--- Avoids any participant joining the room in the interval between creating the room
|
||||
--- and jicofo entering the room
|
||||
module:hook('muc-occupant-pre-join', function (event)
|
||||
local room, stanza = event.room, event.stanza;
|
||||
|
||||
-- we skip processing only if jicofo_lock is set to false
|
||||
if room._data.jicofo_lock == false or is_healthcheck_room(room.jid) then
|
||||
local function process_region(session, stanza)
|
||||
if not session.user_region then
|
||||
return;
|
||||
end
|
||||
|
||||
local region = stanza:get_child_text('jitsi_participant_region');
|
||||
if region then
|
||||
return;
|
||||
end
|
||||
|
||||
stanza:tag('jitsi_participant_region'):text(session.user_region):up();
|
||||
end
|
||||
|
||||
--- Avoids any participant joining the room in the interval between creating the room
|
||||
--- and jicofo entering the room
|
||||
module:hook('muc-occupant-pre-join', function (event)
|
||||
local occupant, room, stanza = event.occupant, event.room, event.stanza;
|
||||
|
||||
local is_health_room = is_healthcheck_room(room.jid);
|
||||
-- check for region
|
||||
if not is_admin(occupant.bare_jid) and not is_health_room then
|
||||
process_region(event.origin, stanza);
|
||||
end
|
||||
|
||||
-- we skip processing only if jicofo_lock is set to false
|
||||
if room._data.jicofo_lock == false or is_health_room then
|
||||
return;
|
||||
end
|
||||
|
||||
local occupant = event.occupant;
|
||||
if ends_with(occupant.nick, '/focus') then
|
||||
module:fire_event('jicofo-unlock-room', { room = room; });
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user