Commit f73ab4e8 authored by JC Brand's avatar JC Brand

Allow otr and CryptoJS to not be defined.

Will allow builds without OTR functionality.
parent a3821fd0
......@@ -29,7 +29,11 @@
evaluate : /\{\[([\s\S]+?)\]\}/g,
interpolate : /\{\{([\s\S]+?)\}\}/g
};
return factory(jQuery, _, CryptoJS, otr.OTR, otr.DSA, console);
if (typeof otr !== "undefined") {
return factory(jQuery, _, CryptoJS, otr.OTR, otr.DSA, console);
} else {
return factory(jQuery, _, undefined, undefined, undefined, console);
}
});
} else {
// Browser globals
......@@ -57,6 +61,11 @@
(typeof crypto.randomBytes !== 'function') &&
(typeof crypto.getRandomValues !== 'function')
));
var HAS_CRYPTO = HAS_CSPRNG && (
(typeof CryptoJS !== "undefined") &&
(typeof OTR !== "undefined") &&
(typeof DSA !== "undefined")
);
// Default configuration values
// ----------------------------
......@@ -109,7 +118,7 @@
]));
// Only allow OTR if we have the capability
this.allow_otr = this.allow_otr && HAS_CSPRNG;
this.allow_otr = this.allow_otr && HAS_CRYPTO;
// Translation machinery
// ---------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment