Browse Source

Log initialization result in service and use result directly from API.

pull/225/head
Joachim Bauch 11 years ago
parent
commit
848289a9e5
  1. 8
      static/js/mediastream/api.js
  2. 8
      static/js/services/endtoendencryption.js

8
static/js/mediastream/api.js

@ -29,13 +29,7 @@ define(['jquery', 'underscore', 'ua-parser'], function($, _, uaparser) {
this.sid = null; this.sid = null;
this.session = {}; this.session = {};
this.connector = connector; this.connector = connector;
if (!endToEndEncryption.initialize(this)) { this.endToEndEncryption = endToEndEncryption.initialize(this);
console.warn("Encryption services failed to initialize");
this.endToEndEncryption = null;
} else {
console.log("Encryption services initialized");
this.endToEndEncryption = endToEndEncryption;
}
this.iids= 0; this.iids= 0;
var ua = uaparser(); var ua = uaparser();

8
static/js/services/endtoendencryption.js

@ -668,14 +668,16 @@ define([
var endToEndEncryptionApi = { var endToEndEncryptionApi = {
"initialize": function(api) { "initialize": function(api) {
if (endToEndEncryption) { if (endToEndEncryption) {
return true; return endToEndEncryption;
} }
endToEndEncryption = new EndToEndEncryption(api); endToEndEncryption = new EndToEndEncryption(api);
if (!endToEndEncryption.isSupported()) { if (!endToEndEncryption.isSupported()) {
console.warn("EndToEnd encryption services not supported");
endToEndEncryption = null; endToEndEncryption = null;
return false; return null;
} }
return true; console.log("EndToEnd encryption services initialized");
return endToEndEncryption;
}, },
"encrypt": function(peer, type, message, callback) { "encrypt": function(peer, type, message, callback) {
if (!endToEndEncryption) { if (!endToEndEncryption) {

Loading…
Cancel
Save