Просмотр исходного кода

Activates multidomain by default when installing with nginx.

master
damencho 5 лет назад
Родитель
Сommit
ebfc5a95ff

+ 2
- 0
debian/jitsi-meet-web-config.postinst Просмотреть файл

@@ -99,6 +99,8 @@ case "$1" in
99 99
         JITSI_MEET_CONFIG="/etc/jitsi/meet/$JVB_HOSTNAME-config.js"
100 100
         if [ ! -f $JITSI_MEET_CONFIG ] ; then
101 101
             cp /usr/share/jitsi-meet-web-config/config.js $JITSI_MEET_CONFIG
102
+            # replaces needed config for multidomain as it works only with nginx
103
+            sed -i "s/conference.jitsi-meet.example.com/conference.<\!--# echo var=\"subdomain\" default=\"\" -->jitsi-meet.example.com/g" $JITSI_MEET_CONFIG
102 104
             sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" $JITSI_MEET_CONFIG
103 105
         fi
104 106
 

+ 4
- 0
doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example Просмотреть файл

@@ -1,5 +1,8 @@
1 1
 plugin_paths = { "/usr/share/jitsi-meet/prosody-plugins/" }
2 2
 
3
+-- domain mapper options, must at least have domain base set to use the mapper
4
+muc_mapper_domain_base = "jitmeet.example.com";
5
+
3 6
 VirtualHost "jitmeet.example.com"
4 7
         -- enabled = false -- Remove this line to enable this host
5 8
         authentication = "anonymous"
@@ -28,6 +31,7 @@ Component "conference.jitmeet.example.com" "muc"
28 31
     storage = "null"
29 32
     modules_enabled = {
30 33
         "muc_meeting_id";
34
+        "muc_domain_mapper";
31 35
         -- "token_verification";
32 36
     }
33 37
 admins = { "focusUser@auth.jitmeet.example.com" }

+ 28
- 0
doc/debian/jitsi-meet/jitsi-meet.example Просмотреть файл

@@ -19,7 +19,11 @@ server {
19 19
     ssl_certificate_key /etc/jitsi/meet/jitsi-meet.example.com.key;
20 20
 
21 21
     root /usr/share/jitsi-meet;
22
+
23
+    # ssi on with javascript for multidomain variables in config.js
22 24
     ssi on;
25
+    ssi_types application/x-javascript application/javascript;
26
+
23 27
     index index.html index.htm;
24 28
     error_page 404 /static/404.html;
25 29
 
@@ -52,4 +56,28 @@ server {
52 56
     location @root_path {
53 57
         rewrite ^/(.*)$ / break;
54 58
     }
59
+
60
+    location ~ ^/([^/?&:'"]+)/config.js$
61
+    {
62
+       set $subdomain "$1.";
63
+       set $subdir "$1/";
64
+
65
+       alias /etc/jitsi/meet/jitsi-meet.example.com-config.js;
66
+    }
67
+
68
+    #Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to /
69
+    location ~ ^/([^/?&:'"]+)/(.*)$ {
70
+        set $subdomain "$1.";
71
+        set $subdir "$1/";
72
+        rewrite ^/([^/?&:'"]+)/(.*)$ /$2;
73
+    }
74
+
75
+    # BOSH for subdomains
76
+    location ~ ^/([^/?&:'"]+)/http-bind {
77
+        set $subdomain "$1.";
78
+        set $subdir "$1/";
79
+        set $prefix "$1";
80
+
81
+        rewrite ^/(.*)$ /http-bind;
82
+    }
55 83
 }

+ 1
- 5
doc/example-config-files/multidomain/jitsi.example.com.multidomain.example Просмотреть файл

@@ -36,10 +36,6 @@ server {
36 36
         rewrite ^/(.*)$ / break;
37 37
     }
38 38
 
39
-    location / {
40
-        ssi on;
41
-    }
42
-
43 39
     location ~ ^/([^/?&:'"]+)/config.js$
44 40
     {
45 41
        set $subdomain "$1.";
@@ -64,4 +60,4 @@ server {
64 60
         rewrite ^/(.*)$ /http-bind;
65 61
     }
66 62
 
67
-}
63
+}

+ 0
- 2
doc/example-config-files/multidomain/prosody.cfg.multidomain.example Просмотреть файл

@@ -83,8 +83,6 @@ modules_enabled = {
83 83
 		"adhoc";
84 84
 		"websocket";
85 85
 		"http_altconnect";
86
-    -- include domain mapper as global level module
87
-        "muc_domain_mapper";
88 86
 }
89 87
 
90 88
 -- domain mapper options, must at least have domain base set to use the mapper

+ 11
- 9
resources/prosody-plugins/mod_muc_domain_mapper.lua Просмотреть файл

@@ -1,8 +1,6 @@
1 1
 -- Maps MUC JIDs like room1@muc.foo.example.com to JIDs like [foo]room1@muc.example.com
2 2
 -- Must be loaded on the client host in Prosody
3 3
 
4
-module:set_global();
5
-
6 4
 -- It is recommended to set muc_mapper_domain_base to the main domain being served (example.com)
7 5
 
8 6
 local jid = require "util.jid";
@@ -13,7 +11,7 @@ local muc_domain_prefix = module:get_option_string("muc_mapper_domain_prefix", "
13 11
 
14 12
 local muc_domain_base = module:get_option_string("muc_mapper_domain_base");
15 13
 if not muc_domain_base then
16
-    module:log("warn", "No 'muc_domain_base' option set, disabling muc_mapper plugin inactive");
14
+    module:log("warn", "No 'muc_mapper_domain_base' option set, disabling muc_mapper plugin inactive");
17 15
     return
18 16
 end
19 17
 
@@ -116,14 +114,14 @@ end
116 114
 function module.load()
117 115
     if module.reloading then
118 116
         module:log("debug", "Reloading MUC mapper!");
119
-    else        
117
+    else
120 118
         module:log("debug", "First load of MUC mapper!");
121 119
     end
122 120
     filters.add_filter_hook(filter_session);
123 121
 end
124 122
 
125 123
 function module.unload()
126
-    filters.remove_filter_hook(filter_session); 
124
+    filters.remove_filter_hook(filter_session);
127 125
 end
128 126
 
129 127
 
@@ -150,10 +148,14 @@ local function hook_all_stanzas(handler, host_module, event_prefix)
150 148
     end
151 149
 end
152 150
 
153
-
154
-function module.add_host(host_module)
155
-    module:log("info",
156
-               "Loading mod_muc_domain_mapper for host %s!", host_module.host);
151
+function add_host(host)
152
+    module:log("info", "Loading mod_muc_domain_mapper for host %s!", host);
153
+    local host_module = module:context(host);
157 154
     hook_all_stanzas(incoming_stanza_rewriter, host_module);
158 155
     hook_all_stanzas(outgoing_stanza_rewriter, host_module, "pre-");
159 156
 end
157
+
158
+prosody.events.add_handler("host-activated", add_host);
159
+for host in pairs(prosody.hosts) do
160
+    add_host(host);
161
+end

Загрузка…
Отмена
Сохранить