This commit is contained in:
unkelpehr 2014-09-25 10:15:41 +02:00
parent 213ab4f3a2
commit bb69313463
3 changed files with 10 additions and 11 deletions

View File

@ -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). // 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', // 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', 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' domReady: 'https://cdnjs.cloudflare.com/ajax/libs/require-domReady/2.0.1/domReady.min.js'
}, },
@ -19,9 +20,9 @@ fandango.defaults({
return CryptoJS.AES; return CryptoJS.AES;
} }
}, },
md5: { SHA1: {
exports: function () { exports: function () {
return CryptoJS.MD5; return CryptoJS.SHA1;
} }
} }
} }

View File

@ -1,4 +1,4 @@
define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) { define(['fandango', 'websocket', 'aes', 'SHA1'], function (fandango, websocket, aes, SHA1) {
var exports = { var exports = {
selector: 0, selector: 0,
utilities: {}, utilities: {},
@ -19,7 +19,7 @@ define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) {
* @private * @private
*/ */
reDigits = /^\d+$/; reDigits = /^\d+$/;
// The DOM selector engine // The DOM selector engine
exports.selector = function (selector) { exports.selector = function (selector) {
var match, var match,
@ -39,10 +39,9 @@ define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) {
return matches; return matches;
}; };
// Namespace AES // Namespace SHA1
utils.AES = { utils.SHA1 = function (string) {
decrypt: aes.decrypt, return SHA1(string).toString();
encrypt: aes.encrypt
}; };
// Namespace encode // Namespace encode

View File

@ -167,14 +167,13 @@ define({
} }
if (request) { if (request) {
require([request], function (settings) { return require([request], function (settings) {
host.settings = settings; host.settings = settings;
commands.connect(toHost, done); commands.connect(toHost, done);
}, function () { }, function () {
post('error', 'Could not fetch host settings: ' + request); post('error', 'Could not fetch host settings: ' + request);
return done(); return done();
}); });
return done();
} }
// Push 'Connecting...' message // Push 'Connecting...' message
@ -372,7 +371,7 @@ define({
return ( return (
room room
? post('error', templates.messages.already_in_room) ? post('error', templates.messages.already_in_room)
: socket.emit('room:join', $.MD5(payload)) : socket.emit('room:join', $.SHA1(payload))
); );
}, },