Ver código fonte

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
factor2
Дамян Минков 4 meses atrás
pai
commit
d563913499
Nenhuma conta vinculada ao e-mail do autor do commit

+ 5
- 5
package-lock.json Ver arquivo

@@ -62,7 +62,7 @@
62 62
         "js-md5": "0.6.1",
63 63
         "js-sha512": "0.8.0",
64 64
         "jwt-decode": "2.2.0",
65
-        "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
65
+        "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
66 66
         "lodash-es": "4.17.21",
67 67
         "moment": "2.29.4",
68 68
         "moment-duration-format": "2.2.2",
@@ -16954,8 +16954,8 @@
16954 16954
     },
16955 16955
     "node_modules/lib-jitsi-meet": {
16956 16956
       "version": "0.0.0",
16957
-      "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
16958
-      "integrity": "sha512-4w+/VkFNzj6rnbogfF6JHgL48pxo/Pq4GX6RXodnUGJMwu1Zc+nGw3SR/KJYqtxCfO9hAb+NBZVQfQvN16xRxg==",
16957
+      "resolved": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
16958
+      "integrity": "sha512-qll80OJZol+xlDt3n58SqGPYQPer72C28XE9lSEtfOx6XdFdhLYXSzaNpPY4OP2tFjJqNX+Y2ZQkSkARGSqVrg==",
16959 16959
       "hasInstallScript": true,
16960 16960
       "license": "Apache-2.0",
16961 16961
       "dependencies": {
@@ -37739,8 +37739,8 @@
37739 37739
       }
37740 37740
     },
37741 37741
     "lib-jitsi-meet": {
37742
-      "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
37743
-      "integrity": "sha512-4w+/VkFNzj6rnbogfF6JHgL48pxo/Pq4GX6RXodnUGJMwu1Zc+nGw3SR/KJYqtxCfO9hAb+NBZVQfQvN16xRxg==",
37742
+      "version": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
37743
+      "integrity": "sha512-qll80OJZol+xlDt3n58SqGPYQPer72C28XE9lSEtfOx6XdFdhLYXSzaNpPY4OP2tFjJqNX+Y2ZQkSkARGSqVrg==",
37744 37744
       "requires": {
37745 37745
         "@jitsi/js-utils": "2.2.1",
37746 37746
         "@jitsi/logger": "2.0.2",

+ 1
- 1
package.json Ver arquivo

@@ -68,7 +68,7 @@
68 68
     "js-md5": "0.6.1",
69 69
     "js-sha512": "0.8.0",
70 70
     "jwt-decode": "2.2.0",
71
-    "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1906.0.0+dfc23df4/lib-jitsi-meet.tgz",
71
+    "lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1907.0.0+0d3304b7/lib-jitsi-meet.tgz",
72 72
     "lodash-es": "4.17.21",
73 73
     "moment": "2.29.4",
74 74
     "moment-duration-format": "2.2.2",

+ 3
- 0
resources/prosody-plugins/mod_jitsi_session.lua Ver arquivo

@@ -3,6 +3,7 @@
3 3
 module:set_global();
4 4
 
5 5
 local formdecode = require "util.http".formdecode;
6
+local region_header_name = module:get_option_string('region_header_name', 'x_proxy_region');
6 7
 
7 8
 -- Extract the following parameters from the URL and set them in the session:
8 9
 -- * previd: for session resumption
@@ -24,6 +25,8 @@ function init_session(event)
24 25
         session.jitsi_web_query_room = params.room;
25 26
         session.jitsi_web_query_prefix = params.prefix or "";
26 27
     end
28
+
29
+    session.user_region = request.headers[region_header_name];
27 30
 end
28 31
 
29 32
 module:hook_global("bosh-session", init_session, 1);

+ 21
- 3
resources/prosody-plugins/mod_muc_meeting_id.lua Ver arquivo

@@ -75,17 +75,35 @@ module:hook('muc-broadcast-presence', function (event)
75 75
     end
76 76
 end);
77 77
 
78
+local function process_region(session, stanza)
79
+    if not session.user_region then
80
+        return;
81
+    end
82
+
83
+    local region = stanza:get_child_text('jitsi_participant_region');
84
+    if region then
85
+        return;
86
+    end
87
+
88
+    stanza:tag('jitsi_participant_region'):text(session.user_region):up();
89
+end
90
+
78 91
 --- Avoids any participant joining the room in the interval between creating the room
79 92
 --- and jicofo entering the room
80 93
 module:hook('muc-occupant-pre-join', function (event)
81
-    local room, stanza = event.room, event.stanza;
94
+    local occupant, room, stanza = event.occupant, event.room, event.stanza;
95
+
96
+    local is_health_room = is_healthcheck_room(room.jid);
97
+    -- check for region
98
+    if not is_admin(occupant.bare_jid) and not is_health_room then
99
+        process_region(event.origin, stanza);
100
+    end
82 101
 
83 102
     -- we skip processing only if jicofo_lock is set to false
84
-    if room._data.jicofo_lock == false or is_healthcheck_room(room.jid) then
103
+    if room._data.jicofo_lock == false or is_health_room then
85 104
         return;
86 105
     end
87 106
 
88
-    local occupant = event.occupant;
89 107
     if ends_with(occupant.nick, '/focus') then
90 108
         module:fire_event('jicofo-unlock-room', { room = room; });
91 109
     else

Carregando…
Cancelar
Salvar