Fix indentation

This commit is contained in:
Jake 2014-10-19 15:40:56 -05:00
parent 48d33eae25
commit 30976671de

View File

@ -9,56 +9,56 @@ var lwip = require('lwip');
* https://github.com/jomo/Crafatar * https://github.com/jomo/Crafatar
*/ */
module.exports = { module.exports = {
get_profile: function(uuid, callback) { get_profile: function(uuid, callback) {
https.get("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid, function(res) { https.get("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid, function(res) {
if (res.statusCode == "204") { if (res.statusCode == "204") {
callback(null); callback(null);
return null; return null;
} }
res.on('data', function(d) { res.on('data', function(d) {
var profile = JSON.parse(d); var profile = JSON.parse(d);
if (profile.error) callback(null); if (profile.error) callback(null);
callback(profile); callback(profile);
}); });
}).on('error', function(e) { }).on('error', function(e) {
console.error(e); console.error(e);
}); });
}, },
skin_url: function(profile) { skin_url: function(profile) {
var url = null; var url = null;
if (profile && profile.properties) { if (profile && profile.properties) {
profile.properties.forEach(function(prop) { profile.properties.forEach(function(prop) {
if (prop.name == 'textures') { if (prop.name == 'textures') {
var json = Buffer(prop.value, 'base64').toString(); var json = Buffer(prop.value, 'base64').toString();
var props = JSON.parse(json); var props = JSON.parse(json);
url = props.textures.SKIN.url; url = props.textures.SKIN.url;
} }
}); });
} }
return url; return url;
}, },
skin_file: function(url, filename, callback) { skin_file: function(url, filename, callback) {
var file = fs.createWriteStream(filename); var file = fs.createWriteStream(filename);
http.get(url, function(res) { http.get(url, function(res) {
res.on('data', function(data) { res.on('data', function(data) {
file.write(data); file.write(data);
}).on('end', function() { }).on('end', function() {
file.end(); file.end();
callback(); callback();
}); });
}); });
}, },
extract_face: function(infile, size, callback) { extract_face: function(infile, size, callback) {
lwip.open(infile, function(err, image){ lwip.open(infile, function(err, image){
image.batch() image.batch()
.crop(8,8,15,15) .crop(8,8,15,15)
.resize(size, size, "nearest-neighbor") .resize(size, size, "nearest-neighbor")
.toBuffer('png', function(err, buffer){ .toBuffer('png', function(err, buffer){
callback(buffer); callback(buffer);
}); });
}); });
} }
}; };