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).
// 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;
}
}
}

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 = {
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

View File

@ -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))
);
},