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
|
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 835 B |
@@ -176,7 +176,7 @@ h4 {
|
||||
background-image: url("/avatars/853c80ef3c3749fdaa49938b674adae6");
|
||||
}
|
||||
#avatar-example-5:hover .preview {
|
||||
background-image: url("/avatars/0?default=alex");
|
||||
background-image: url("/avatars/0?default=mhf_alex");
|
||||
}
|
||||
#avatar-example-6:hover .preview {
|
||||
background-image: url("/avatars/0?default=https%3A%2F%2Fi.imgur.com%2FocJVWAc.png");
|
||||
@@ -193,7 +193,7 @@ h4 {
|
||||
background-image: url("/skins/jeb_");
|
||||
}
|
||||
#skin-example-2:hover .preview {
|
||||
background-image: url("/skins/0?default=alex");
|
||||
background-image: url("/skins/0?default=mhf_alex");
|
||||
}
|
||||
|
||||
#cape-example-1:hover .preview {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -56,7 +56,7 @@ exp.extract_helm = function(rid, facefile, buffer, outname, callback) {
|
||||
} else {
|
||||
face_helm_img.toBuffer("png", {compression: "none"}, function(buf_err2, face_helm_buffer) {
|
||||
if (buf_err2) {
|
||||
callback(buf_err2)
|
||||
callback(buf_err2);
|
||||
} else {
|
||||
if (face_helm_buffer.toString() !== face_buffer.toString()) {
|
||||
face_helm_img.writeFile(outname, function(write_err) {
|
||||
@@ -101,11 +101,11 @@ exp.resize_img = function(inname, size, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
// returns "alex" or "steve" calculated by the +uuid+
|
||||
// returns "mhf_alex" or "mhf_steve" calculated by the +uuid+
|
||||
exp.default_skin = function(uuid) {
|
||||
if (uuid.length <= 16) {
|
||||
// we can't get the skin type by username
|
||||
return "steve";
|
||||
return "mhf_steve";
|
||||
} else {
|
||||
// great thanks to Minecrell for research into Minecraft and Java's UUID hashing!
|
||||
// https://git.io/xJpV
|
||||
@@ -117,7 +117,7 @@ exp.default_skin = function(uuid) {
|
||||
parseInt(uuid[15], 16) ^
|
||||
parseInt(uuid[23], 16) ^
|
||||
parseInt(uuid[31], 16);
|
||||
return lsbs_even ? "alex" : "steve";
|
||||
return lsbs_even ? "mhf_alex" : "mhf_steve";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -62,14 +62,14 @@ block content
|
||||
td default
|
||||
td string
|
||||
td
|
||||
| The standard value is calculated based on the UUID (even = alex, odd = steve).<br>
|
||||
| Usernames always default to steve.
|
||||
| The standard value is calculated based on the UUID (even = MHF_Alex, odd = MHF_Steve).<br>
|
||||
| Usernames always default to MHF_Steve.
|
||||
td
|
||||
| The image to be served when the userid has no skin.<br>
|
||||
| Valid options are
|
||||
a(href="/avatars/0?default=steve") steve
|
||||
| ,
|
||||
a(href="/avatars/0?default=alex") alex
|
||||
| Valid options are any userid, including
|
||||
a(href="/avatars/0?default=MHF_Steve") MHF_Steve
|
||||
| and
|
||||
a(href="/avatars/0?default=MHF_Alex") MHF_Alex
|
||||
| , or a custom URL.
|
||||
tr
|
||||
td helm
|
||||
@@ -95,8 +95,8 @@ block content
|
||||
.example #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6
|
||||
p.preview Jeb's avatar by UUID
|
||||
#avatar-example-5.example-wrapper
|
||||
.example #{domain}/avatars/jeb_?default=alex
|
||||
p.preview Jeb's avatar, or fall back to alex <i>(this example assumes jeb_ does not exist)</i>
|
||||
.example #{domain}/avatars/jeb_?default=MHF_Alex
|
||||
p.preview Jeb's avatar, or fall back to MHF_Alex <i>(this example assumes jeb_ does not exist)</i>
|
||||
#avatar-example-6.example-wrapper
|
||||
.example #{domain}/avatars/jeb_?default=https%3A%2F%2Fi.imgur.com%2FocJVWAc.png
|
||||
p.preview
|
||||
@@ -195,14 +195,14 @@ block content
|
||||
td default
|
||||
td string
|
||||
td
|
||||
| The standard value is calculated based on the UUID (even = alex, odd = steve).<br>
|
||||
| Usernames always default to steve.
|
||||
| The standard value is calculated based on the UUID (even = MHF_Alex, odd = MHF_Steve).<br>
|
||||
| Usernames always default to MHF_Steve.
|
||||
td
|
||||
| The image to be served when the userid has no skin.<br>
|
||||
| Valid options are
|
||||
a(href="/skins/0?default=steve") steve
|
||||
| ,
|
||||
a(href="/skins/0?default=alex") alex
|
||||
| Valid options are any userid, including
|
||||
a(href="/skins/0?default=MHF_Steve") MHF_Steve
|
||||
| and
|
||||
a(href="/skins/0?default=MHF_Alex") MHF_Alex
|
||||
| , or a custom URL.
|
||||
|
||||
section
|
||||
@@ -214,8 +214,8 @@ block content
|
||||
.example #{domain}/skins/jeb_
|
||||
p.preview Jeb's skin
|
||||
#skin-example-2.example-wrapper
|
||||
.example #{domain}/skins/jeb_?default=alex
|
||||
p.preview Jeb's skin, or fall back to alex <i>(this example assumes jeb_ does not exist)</i>
|
||||
.example #{domain}/skins/jeb_?default=MHF_Alex
|
||||
p.preview Jeb's skin, or fall back to MHF_Alex <i>(this example assumes jeb_ does not exist)</i>
|
||||
p.preview-placeholder
|
||||
| Hover over the example URLs above for a preview!
|
||||
.preview-background
|
||||
@@ -347,7 +347,7 @@ block content
|
||||
img.preload(src="/avatars/020242a17b9441799eff511eea1221da?size=64", alt="preloaded image")
|
||||
img.preload(src="/avatars/020242a17b9441799eff511eea1221da?size=64&helm", alt="preloaded image")
|
||||
img.preload(src="/avatars/069a79f444e94726a5befca90e38aaf5?size=64", alt="preloaded image")
|
||||
img.preload(src="/avatars/0?default=alex", alt="preloaded image")
|
||||
img.preload(src="/avatars/0?default=MHF_Alex", alt="preloaded image")
|
||||
img.preload(src="/avatars/0?default=https%3A%2F%2Fi.imgur.com%2FocJVWAc.png", alt="preloaded image")
|
||||
img.preload(src="/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=64", alt="preloaded image")
|
||||
img.preload(src="/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=64&helm", alt="preloaded image")
|
||||
@@ -393,5 +393,5 @@ block content
|
||||
img.preload(src="/capes/md_5", alt="preloaded image")
|
||||
img.preload(src="/renders/body/jeb_?helm&scale=4", alt="preloaded image")
|
||||
img.preload(src="/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=8", alt="preloaded image")
|
||||
img.preload(src="/skins/0?default=alex", alt="preloaded image")
|
||||
img.preload(src="/skins/0?default=MHF_Alex", alt="preloaded image")
|
||||
img.preload(src="/skins/jeb_", alt="preloaded image")
|
||||