rename helm to overlay, fixes #127

This commit is contained in:
jomo
2015-10-18 15:11:17 +02:00
parent e8ab044d91
commit d307aec221
8 changed files with 122 additions and 122 deletions

View File

@@ -50,7 +50,7 @@ module.exports = function(req, callback) {
var userId = (req.url.path_list[1] || "").split(".")[0];
var size = parseInt(req.url.query.size) || config.avatars.default_size;
var def = req.url.query.default;
var helm = req.url.query.hasOwnProperty("helm");
var overlay = req.url.query.hasOwnProperty("overlay") || req.url.query.hasOwnProperty("helm");
// check for extra paths
if (req.url.path_list.length > 2) {
@@ -83,7 +83,7 @@ module.exports = function(req, callback) {
userId = userId.replace(/-/g, "");
try {
helpers.get_avatar(req.id, userId, helm, size, function(err, status, image, hash) {
helpers.get_avatar(req.id, userId, overlay, size, function(err, status, image, hash) {
if (err) {
if (err.code === "ENOENT") {
// no such file

View File

@@ -9,8 +9,8 @@ var url = require("url");
var fs = require("fs");
// valid types: head, body
// helmet is query param
function handle_default(rid, scale, helm, body, img_status, userId, size, def, req, err, callback) {
// overlay is query param
function handle_default(rid, scale, overlay, body, img_status, userId, size, def, req, err, callback) {
def = def || skins.default_skin(userId);
if (def !== "steve" && def !== "mhf_steve" && def !== "alex" && def !== "mhf_alex") {
if (helpers.id_valid(def)) {
@@ -40,7 +40,7 @@ function handle_default(rid, scale, helm, body, img_status, userId, size, def, r
}
fs.readFile(path.join(__dirname, "..", "public", "images", def + "_skin.png"), function (fs_err, buf) {
// we render the default skins, but not custom images
renders.draw_model(rid, buf, scale, helm, body, function(render_err, def_img) {
renders.draw_model(rid, buf, scale, overlay, body, function(render_err, def_img) {
callback({
status: img_status,
body: def_img,
@@ -61,7 +61,7 @@ module.exports = function(req, callback) {
var userId = (req.url.path_list[2] || "").split(".")[0];
var def = req.url.query.default;
var scale = parseInt(req.url.query.scale) || config.renders.default_scale;
var helm = req.url.query.hasOwnProperty("helm");
var overlay = req.url.query.hasOwnProperty("overlay") || req.url.query.hasOwnProperty("helm");
// check for extra paths
if (req.url.path_list.length > 3) {
@@ -100,7 +100,7 @@ module.exports = function(req, callback) {
userId = userId.replace(/-/g, "");
try {
helpers.get_render(rid, userId, scale, helm, body, function(err, status, hash, image) {
helpers.get_render(rid, userId, scale, overlay, body, function(err, status, hash, image) {
if (err) {
if (err.code === "ENOENT") {
// no such file
@@ -117,10 +117,10 @@ module.exports = function(req, callback) {
});
} else {
logging.debug(rid, "image not found, using default.");
handle_default(rid, scale, helm, body, status, userId, scale, def, req, err, callback);
handle_default(rid, scale, overlay, body, status, userId, scale, def, req, err, callback);
}
});
} catch(e) {
handle_default(rid, scale, helm, body, -1, userId, scale, def, req, e, callback);
handle_default(rid, scale, overlay, body, -1, userId, scale, def, req, e, callback);
}
};