瀏覽代碼

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

j8
Damian Minkov 11 年之前
父節點
當前提交
aeaa70ca0c
共有 3 個文件被更改,包括 13 次插入1 次删除
  1. 1
    1
      app.js
  2. 1
    0
      config.js
  3. 11
    0
      muc.js

+ 1
- 1
app.js 查看文件

66
         return;
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
     connect(jid);
70
     connect(jid);
71
 }
71
 }
72
 
72
 

+ 1
- 0
config.js 查看文件

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

+ 11
- 0
muc.js 查看文件

157
         var from = pres.getAttribute('from');
157
         var from = pres.getAttribute('from');
158
         if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
158
         if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
159
             $(document).trigger('passwordrequired.muc', [from]);
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
         } else {
171
         } else {
161
             console.warn('onPresError ', pres);
172
             console.warn('onPresError ', pres);
162
         }
173
         }

Loading…
取消
儲存