Sfoglia il codice sorgente

Handles two domains one for anonymous users, and one for authorized one, where only authorized users can create chat rooms.

j8
Damian Minkov 11 anni fa
parent
commit
aeaa70ca0c
3 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 1
    1
      app.js
  2. 1
    0
      config.js
  3. 11
    0
      muc.js

+ 1
- 1
app.js Vedi File

@@ -66,7 +66,7 @@ function init() {
66 66
         return;
67 67
     }
68 68
 
69
-    var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
69
+    var jid = document.getElementById('jid').value || config.hosts.anonymousdomain || config.hosts.domain || window.location.hostname;
70 70
     connect(jid);
71 71
 }
72 72
 

+ 1
- 0
config.js Vedi File

@@ -1,6 +1,7 @@
1 1
 var config = {
2 2
     hosts: {
3 3
         domain: 'jitsi-meet.example.com',
4
+        //anonymousdomain: 'guest.example.com',
4 5
         muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
5 6
         bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
6 7
         //call_control: 'callcontrol.jitsi-meet.example.com'

+ 11
- 0
muc.js Vedi File

@@ -157,6 +157,17 @@ Strophe.addConnectionPlugin('emuc', {
157 157
         var from = pres.getAttribute('from');
158 158
         if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
159 159
             $(document).trigger('passwordrequired.muc', [from]);
160
+        } else if ($(pres).find(
161
+                '>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
162
+            var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
163
+            if(toDomain === config.hosts.anonymousdomain) {
164
+                // we are connected with anonymous domain and only non anonymous users can create rooms
165
+                // we must authorize the user
166
+                $(document).trigger('passwordrequired.main');
167
+            }
168
+            else
169
+                console.warn('onPresError ', pres);
170
+
160 171
         } else {
161 172
             console.warn('onPresError ', pres);
162 173
         }

Loading…
Annulla
Salva