Handles two domains one for anonymous users, and one for authorized one, where only authorized users can create chat rooms.
This commit is contained in:
parent
f4ab48092a
commit
aeaa70ca0c
2
app.js
2
app.js
|
@ -66,7 +66,7 @@ function init() {
|
|||
return;
|
||||
}
|
||||
|
||||
var jid = document.getElementById('jid').value || config.hosts.domain || window.location.hostname;
|
||||
var jid = document.getElementById('jid').value || config.hosts.anonymousdomain || config.hosts.domain || window.location.hostname;
|
||||
connect(jid);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var config = {
|
||||
hosts: {
|
||||
domain: 'jitsi-meet.example.com',
|
||||
//anonymousdomain: 'guest.example.com',
|
||||
muc: 'conference.jitsi-meet.example.com', // FIXME: use XEP-0030
|
||||
bridge: 'jitsi-videobridge.jitsi-meet.example.com', // FIXME: use XEP-0030
|
||||
//call_control: 'callcontrol.jitsi-meet.example.com'
|
||||
|
|
11
muc.js
11
muc.js
|
@ -157,6 +157,17 @@ Strophe.addConnectionPlugin('emuc', {
|
|||
var from = pres.getAttribute('from');
|
||||
if ($(pres).find('>error[type="auth"]>not-authorized[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
|
||||
$(document).trigger('passwordrequired.muc', [from]);
|
||||
} else if ($(pres).find(
|
||||
'>error[type="cancel"]>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]').length) {
|
||||
var toDomain = Strophe.getDomainFromJid(pres.getAttribute('to'));
|
||||
if(toDomain === config.hosts.anonymousdomain) {
|
||||
// we are connected with anonymous domain and only non anonymous users can create rooms
|
||||
// we must authorize the user
|
||||
$(document).trigger('passwordrequired.main');
|
||||
}
|
||||
else
|
||||
console.warn('onPresError ', pres);
|
||||
|
||||
} else {
|
||||
console.warn('onPresError ', pres);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue