use MHF_Steve and MHF_Alex instead of steve and alex in default parameter

See #142 (not fixed by this commit!)
Basically, this just adds mhf_steve and mhf_alex as special cases for the default parameter only
This commit is contained in:
jomo
2015-09-30 00:38:32 +02:00
parent fd4fb0764c
commit ecfec6a407
11 changed files with 84 additions and 75 deletions

View File

@@ -7,7 +7,7 @@ var url = require("url");
function handle_default(img_status, userId, size, def, req, err, callback) {
def = def || skins.default_skin(userId);
if (def !== "steve" && def !== "alex") {
if (def !== "steve" && def !== "mhf_steve" && def !== "alex" && def !== "mhf_alex") {
if (helpers.id_valid(def)) {
// clean up the old URL to match new image
var parsed = req.url;
@@ -29,6 +29,9 @@ function handle_default(img_status, userId, size, def, req, err, callback) {
}
} else {
// handle steve and alex
if (def.substr(0, 4) !== "mhf_") {
def = "mhf_" + def;
}
skins.resize_img(path.join(__dirname, "..", "public", "images", def + ".png"), size, function(resize_err, image) {
callback({
status: img_status,

View File

@@ -12,7 +12,7 @@ var fs = require("fs");
// helmet is query param
function handle_default(rid, scale, helm, body, img_status, userId, size, def, req, err, callback) {
def = def || skins.default_skin(userId);
if (def !== "steve" && def !== "alex") {
if (def !== "steve" && def !== "mhf_steve" && def !== "alex" && def !== "mhf_alex") {
if (helpers.id_valid(def)) {
// clean up the old URL to match new image
var parsed = req.url;
@@ -34,6 +34,9 @@ function handle_default(rid, scale, helm, body, img_status, userId, size, def, r
}
} else {
// handle steve and alex
if (def.substr(0, 4) !== "mhf_") {
def = "mhf_" + def;
}
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) {

View File

@@ -8,7 +8,7 @@ var url = require("url");
function handle_default(img_status, userId, def, req, err, callback) {
def = def || skins.default_skin(userId);
if (def !== "steve" && def !== "alex") {
if (def !== "steve" && def !== "mhf_steve" && def !== "alex" && def !== "mhf_alex") {
if (helpers.id_valid(def)) {
// clean up the old URL to match new image
var parsed = req.url;
@@ -30,6 +30,9 @@ function handle_default(img_status, userId, def, req, err, callback) {
}
} else {
// handle steve and alex
if (def.substr(0, 4) !== "mhf_") {
def = "mhf_" + def;
}
lwip.open(path.join(__dirname, "..", "public", "images", def + "_skin.png"), function(lwip_err, image) {
if (image) {
image.toBuffer("png", function(buf_err, buffer) {