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) {
yggdrasil.validate(options.session.accessToken, function(ok) {
if (ok)
cb(null, options.sesson);
cb(null, options.session);
else
yggdrasil.refresh(options.session.accessToken, options.session.clientToken, function(err, _, data) {
cb(err, data);

View File

@ -181,15 +181,14 @@ function createServer(options) {
nextStep();
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) {
client.end("Failed to verify username!");
return;
}
client.uuid = uuid;
// Convert to a valid UUID until the session server updates and does
// 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;
loginClient();
});