mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
Fix indentation
This commit is contained in:
parent
48d33eae25
commit
30976671de
98
skins.js
98
skins.js
@ -9,56 +9,56 @@ var lwip = require('lwip');
|
||||
* https://github.com/jomo/Crafatar
|
||||
*/
|
||||
module.exports = {
|
||||
get_profile: function(uuid, callback) {
|
||||
https.get("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid, function(res) {
|
||||
if (res.statusCode == "204") {
|
||||
callback(null);
|
||||
return null;
|
||||
}
|
||||
res.on('data', function(d) {
|
||||
var profile = JSON.parse(d);
|
||||
if (profile.error) callback(null);
|
||||
callback(profile);
|
||||
});
|
||||
get_profile: function(uuid, callback) {
|
||||
https.get("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid, function(res) {
|
||||
if (res.statusCode == "204") {
|
||||
callback(null);
|
||||
return null;
|
||||
}
|
||||
res.on('data', function(d) {
|
||||
var profile = JSON.parse(d);
|
||||
if (profile.error) callback(null);
|
||||
callback(profile);
|
||||
});
|
||||
|
||||
}).on('error', function(e) {
|
||||
console.error(e);
|
||||
});
|
||||
},
|
||||
}).on('error', function(e) {
|
||||
console.error(e);
|
||||
});
|
||||
},
|
||||
|
||||
skin_url: function(profile) {
|
||||
var url = null;
|
||||
if (profile && profile.properties) {
|
||||
profile.properties.forEach(function(prop) {
|
||||
if (prop.name == 'textures') {
|
||||
var json = Buffer(prop.value, 'base64').toString();
|
||||
var props = JSON.parse(json);
|
||||
url = props.textures.SKIN.url;
|
||||
}
|
||||
});
|
||||
}
|
||||
return url;
|
||||
},
|
||||
skin_url: function(profile) {
|
||||
var url = null;
|
||||
if (profile && profile.properties) {
|
||||
profile.properties.forEach(function(prop) {
|
||||
if (prop.name == 'textures') {
|
||||
var json = Buffer(prop.value, 'base64').toString();
|
||||
var props = JSON.parse(json);
|
||||
url = props.textures.SKIN.url;
|
||||
}
|
||||
});
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
skin_file: function(url, filename, callback) {
|
||||
var file = fs.createWriteStream(filename);
|
||||
http.get(url, function(res) {
|
||||
res.on('data', function(data) {
|
||||
file.write(data);
|
||||
}).on('end', function() {
|
||||
file.end();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
},
|
||||
extract_face: function(infile, size, callback) {
|
||||
lwip.open(infile, function(err, image){
|
||||
image.batch()
|
||||
.crop(8,8,15,15)
|
||||
.resize(size, size, "nearest-neighbor")
|
||||
.toBuffer('png', function(err, buffer){
|
||||
callback(buffer);
|
||||
});
|
||||
});
|
||||
}
|
||||
skin_file: function(url, filename, callback) {
|
||||
var file = fs.createWriteStream(filename);
|
||||
http.get(url, function(res) {
|
||||
res.on('data', function(data) {
|
||||
file.write(data);
|
||||
}).on('end', function() {
|
||||
file.end();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
},
|
||||
extract_face: function(infile, size, callback) {
|
||||
lwip.open(infile, function(err, image){
|
||||
image.batch()
|
||||
.crop(8,8,15,15)
|
||||
.resize(size, size, "nearest-neighbor")
|
||||
.toBuffer('png', function(err, buffer){
|
||||
callback(buffer);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user