Fix createServer

This commit is contained in:
Rob Blanckaert 2015-10-07 20:50:38 -04:00
parent 36d75fd3b6
commit 1efc14be78
2 changed files with 3 additions and 4 deletions

View File

@ -68,7 +68,7 @@ function createClient(options) {
if (options.session) { if (options.session) {
yggdrasil.validate(options.session.accessToken, function(ok) { yggdrasil.validate(options.session.accessToken, function(ok) {
if (ok) if (ok)
cb(null, options.sesson); cb(null, options.session);
else else
yggdrasil.refresh(options.session.accessToken, options.session.clientToken, function(err, _, data) { yggdrasil.refresh(options.session.accessToken, options.session.clientToken, function(err, _, data) {
cb(err, data); cb(err, data);

View File

@ -181,15 +181,14 @@ function createServer(options) {
nextStep(); nextStep();
function verifyUsername() { function verifyUsername() {
yggserver.hasJoined(client.username, serverId, sharedSecret, client.publicKey, function(err, uuid, profile) { yggserver.hasJoined(client.username, serverId, sharedSecret, client.publicKey, function(err, profile) {
if(err) { if(err) {
client.end("Failed to verify username!"); client.end("Failed to verify username!");
return; return;
} }
client.uuid = uuid;
// Convert to a valid UUID until the session server updates and does // Convert to a valid UUID until the session server updates and does
// it automatically // it automatically
client.uuid = client.uuid.replace(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/, "$1-$2-$3-$4-$5"); client.uuid = profile.id.replace(/(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})/, "$1-$2-$3-$4-$5");
client.profile = profile; client.profile = profile;
loginClient(); loginClient();
}); });