diff --git a/public/js/bootstrap.js b/public/js/bootstrap.js index cfb973a..b0d8d10 100644 --- a/public/js/bootstrap.js +++ b/public/js/bootstrap.js @@ -9,6 +9,7 @@ fandango.defaults({ // We'll have to fix the Access Control issue first though (https://github.com/Automattic/socket.io-client/issues/641). // websocket: 'https://cdn.socket.io/socket.io-1.1.0.js', aes: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js', + SHA1: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/sha1.js', domReady: 'https://cdnjs.cloudflare.com/ajax/libs/require-domReady/2.0.1/domReady.min.js' }, @@ -19,9 +20,9 @@ fandango.defaults({ return CryptoJS.AES; } }, - md5: { + SHA1: { exports: function () { - return CryptoJS.MD5; + return CryptoJS.SHA1; } } } diff --git a/public/js/cryptalk_modules/$.js b/public/js/cryptalk_modules/$.js index ad482fe..4577814 100644 --- a/public/js/cryptalk_modules/$.js +++ b/public/js/cryptalk_modules/$.js @@ -1,4 +1,4 @@ -define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) { +define(['fandango', 'websocket', 'aes', 'SHA1'], function (fandango, websocket, aes, SHA1) { var exports = { selector: 0, utilities: {}, @@ -19,7 +19,7 @@ define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) { * @private */ reDigits = /^\d+$/; - + // The DOM selector engine exports.selector = function (selector) { var match, @@ -39,10 +39,9 @@ define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) { return matches; }; - // Namespace AES - utils.AES = { - decrypt: aes.decrypt, - encrypt: aes.encrypt + // Namespace SHA1 + utils.SHA1 = function (string) { + return SHA1(string).toString(); }; // Namespace encode diff --git a/public/js/cryptalk_modules/cryptalk.js b/public/js/cryptalk_modules/cryptalk.js index 8d74b37..ef0e46f 100644 --- a/public/js/cryptalk_modules/cryptalk.js +++ b/public/js/cryptalk_modules/cryptalk.js @@ -167,14 +167,13 @@ define({ } if (request) { - require([request], function (settings) { + return require([request], function (settings) { host.settings = settings; commands.connect(toHost, done); }, function () { post('error', 'Could not fetch host settings: ' + request); return done(); }); - return done(); } // Push 'Connecting...' message @@ -372,7 +371,7 @@ define({ return ( room ? post('error', templates.messages.already_in_room) - : socket.emit('room:join', $.MD5(payload)) + : socket.emit('room:join', $.SHA1(payload)) ); },