Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Simplifies code.
Boris Grozev005cc4b27af3
diff --git a/modules/util/RandomUtil.js b/modules/util/RandomUtil.jsindex 48d13f4cd7..524b193e5d 100644--- a/modules/util/RandomUtil.js+++ b/modules/util/RandomUtil.js@@ -3,6 +3,12 @@*/var ALPHANUM = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';+/**+ * Hexadecimal digits.+ * @const+ */+var HEX_DIGITS = '0123456789abcdef';+/*** Generates random int within the range [min, max]* @param min the minimum value for the generated number@@ -37,38 +43,27 @@ function randomAlphanumStr(length) {return result;}-/**- * Generates random hex number within the range [min, max]- * @param min the minimum value for the generated number- * @param max the maximum value for the generated number- * @returns random hex number- */-function rangeRandomHex(min, max)-{- return randomInt(min, max).toString(16);-}-/*** Exported interface.*/var RandomUtil = {/**- * Generates hex number with length 4- */- random4digitsHex: function () {- return rangeRandomHex(0x1000, 0xFFFF);- },- /**- * Generates hex number with length 8+ * Returns a random hex digit.+ * @returns {*}*/- random8digitsHex: function () {- return rangeRandomHex(0x10000000, 0xFFFFFFFF);+ randomHexDigit: function() {+ return randomElement(HEX_DIGITS);},/**- * Generates hex number with length 12+ * Returns a random string of hex digits with length 'len'.+ * @param len the length.*/- random12digitsHex: function () {- return rangeRandomHex(0x100000000000, 0xFFFFFFFFFFFF);+ randomHexString: function (len) {+ var ret = '';+ while (len--) {+ ret += this.randomHexDigit();+ }+ return ret;}};diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.jsindex 763e10027c..9b28cb49ff 100644--- a/modules/xmpp/xmpp.js+++ b/modules/xmpp/xmpp.js@@ -23,8 +23,9 @@ var authenticatedUser = false;* @returns {string}*/function generateUserName() {- return RandomUtil.random8digitsHex() + "-" + RandomUtil.random4digitsHex() + "-" +- RandomUtil.random4digitsHex() + "-" + RandomUtil.random8digitsHex();+ return RandomUtil.randomHexString(8) + "-" + RandomUtil.randomHexString(4)+ + "-" + RandomUtil.randomHexString(4) + "-"+ + RandomUtil.randomHexString(8);}function connect(jid, password) {