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

@ -256,16 +256,16 @@ exp.get_image_hash = function(rid, userId, type, callback) {
// handles requests for +userId+ avatars with +size+ // handles requests for +userId+ avatars with +size+
// callback: error, status, image buffer, skin hash // callback: error, status, image buffer, skin hash
// image is the user's face+helm when helm is true, or the face otherwise // image is the user's face+overlay when overlay is true, or the face otherwise
// for status, see get_image_hash // for status, see get_image_hash
exp.get_avatar = function(rid, userId, helm, size, callback) { exp.get_avatar = function(rid, userId, overlay, size, callback) {
exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) { exp.get_image_hash(rid, userId, "skin", function(err, status, skin_hash) {
if (skin_hash) { if (skin_hash) {
var facepath = path.join(config.directories.faces, skin_hash + ".png"); var facepath = path.join(config.directories.faces, skin_hash + ".png");
var helmpath = path.join(config.directories.helms, skin_hash + ".png"); var helmpath = path.join(config.directories.helms, skin_hash + ".png");
var filepath = facepath; var filepath = facepath;
fs.exists(helmpath, function(exists) { fs.exists(helmpath, function(exists) {
if (helm && exists) { if (overlay && exists) {
filepath = helmpath; filepath = helmpath;
} }
skins.resize_img(filepath, size, function(img_err, image) { skins.resize_img(filepath, size, function(img_err, image) {
@ -308,22 +308,22 @@ exp.get_skin = function(rid, userId, callback) {
}; };
// helper method used for file names // helper method used for file names
// possible returned names based on +helm+ and +body+ are: // possible returned names based on +overlay+ and +body+ are:
// body, bodyhelm, head, headhelm // body, bodyhelm, head, headhelm
function get_type(helm, body) { function get_type(overlay, body) {
var text = body ? "body" : "head"; var text = body ? "body" : "head";
return helm ? text + "helm" : text; return overlay ? text + "helm" : text;
} }
// handles creations of 3D renders // handles creations of 3D renders
// callback: error, skin hash, image buffer // callback: error, skin hash, image buffer
exp.get_render = function(rid, userId, scale, helm, body, callback) { exp.get_render = function(rid, userId, scale, overlay, body, callback) {
exp.get_skin(rid, userId, function(err, skin_hash, status, img) { exp.get_skin(rid, userId, function(err, skin_hash, status, img) {
if (!skin_hash) { if (!skin_hash) {
callback(err, status, skin_hash, null); callback(err, status, skin_hash, null);
return; return;
} }
var renderpath = path.join(config.directories.renders, [skin_hash, scale, get_type(helm, body)].join("-") + ".png"); var renderpath = path.join(config.directories.renders, [skin_hash, scale, get_type(overlay, body)].join("-") + ".png");
fs.exists(renderpath, function(exists) { fs.exists(renderpath, function(exists) {
if (exists) { if (exists) {
renders.open_render(rid, renderpath, function(render_err, rendered_img) { renders.open_render(rid, renderpath, function(render_err, rendered_img) {
@ -335,7 +335,7 @@ exp.get_render = function(rid, userId, scale, helm, body, callback) {
callback(err, 0, skin_hash, null); callback(err, 0, skin_hash, null);
return; return;
} }
renders.draw_model(rid, img, scale, helm, body, function(draw_err, drawn_img) { renders.draw_model(rid, img, scale, overlay, body, function(draw_err, drawn_img) {
if (draw_err) { if (draw_err) {
callback(draw_err, -1, skin_hash, null); callback(draw_err, -1, skin_hash, null);
} else if (!drawn_img) { } else if (!drawn_img) {

View File

@ -156,64 +156,64 @@ code {
} }
.avatar.jomo {background-image: url("/avatars/ae795aa86327408e92ab25c8a59f3ba1?size=64")} .avatar.jomo {background-image: url("/avatars/ae795aa86327408e92ab25c8a59f3ba1?size=64")}
.avatar.jomo:hover {background-image: url("/avatars/ae795aa86327408e92ab25c8a59f3ba1?size=64&helm")} .avatar.jomo:hover {background-image: url("/avatars/ae795aa86327408e92ab25c8a59f3ba1?size=64&overlay")}
.avatar.jake_0 {background-image: url("/avatars/2d5aa9cdaeb049189930461fc9b91cc5?size=64")} .avatar.jake_0 {background-image: url("/avatars/2d5aa9cdaeb049189930461fc9b91cc5?size=64")}
.avatar.jake_0:hover {background-image: url("/avatars/2d5aa9cdaeb049189930461fc9b91cc5?size=64&helm")} .avatar.jake_0:hover {background-image: url("/avatars/2d5aa9cdaeb049189930461fc9b91cc5?size=64&overlay")}
.avatar.sk89q {background-image: url("/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=64")} .avatar.sk89q {background-image: url("/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=64")}
.avatar.sk89q:hover {background-image: url("/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=64&helm")} .avatar.sk89q:hover {background-image: url("/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=64&overlay")}
.avatar.md_5 {background-image: url("/avatars/af74a02d19cb445bb07f6866a861f783?size=64")} .avatar.md_5 {background-image: url("/avatars/af74a02d19cb445bb07f6866a861f783?size=64")}
.avatar.md_5:hover {background-image: url("/avatars/af74a02d19cb445bb07f6866a861f783?size=64&helm")} .avatar.md_5:hover {background-image: url("/avatars/af74a02d19cb445bb07f6866a861f783?size=64&overlay")}
.avatar.jeb {background-image: url("/avatars/853c80ef3c3749fdaa49938b674adae6?size=64")} .avatar.jeb {background-image: url("/avatars/853c80ef3c3749fdaa49938b674adae6?size=64")}
.avatar.jeb:hover {background-image: url("/avatars/853c80ef3c3749fdaa49938b674adae6?size=64&helm")} .avatar.jeb:hover {background-image: url("/avatars/853c80ef3c3749fdaa49938b674adae6?size=64&overlay")}
.avatar.notch {background-image: url("/avatars/069a79f444e94726a5befca90e38aaf5?size=64")} .avatar.notch {background-image: url("/avatars/069a79f444e94726a5befca90e38aaf5?size=64")}
.avatar.notch:hover {background-image: url("/avatars/069a79f444e94726a5befca90e38aaf5?size=64&helm")} .avatar.notch:hover {background-image: url("/avatars/069a79f444e94726a5befca90e38aaf5?size=64&overlay")}
.avatar.dinnerbone {background-image: url("/avatars/61699b2ed3274a019f1e0ea8c3f06bc6?size=64")} .avatar.dinnerbone {background-image: url("/avatars/61699b2ed3274a019f1e0ea8c3f06bc6?size=64")}
.avatar.dinnerbone:hover {background-image: url("/avatars/61699b2ed3274a019f1e0ea8c3f06bc6?size=64&helm")} .avatar.dinnerbone:hover {background-image: url("/avatars/61699b2ed3274a019f1e0ea8c3f06bc6?size=64&overlay")}
.avatar.ez {background-image: url("/avatars/7d043c7389524696bfba571c05b6aec0?size=64")} .avatar.ez {background-image: url("/avatars/7d043c7389524696bfba571c05b6aec0?size=64")}
.avatar.ez:hover {background-image: url("/avatars/7d043c7389524696bfba571c05b6aec0?size=64&helm")} .avatar.ez:hover {background-image: url("/avatars/7d043c7389524696bfba571c05b6aec0?size=64&overlay")}
.avatar.grumm {background-image: url("/avatars/e6b5c088068044df9e1b9bf11792291b?size=64")} .avatar.grumm {background-image: url("/avatars/e6b5c088068044df9e1b9bf11792291b?size=64")}
.avatar.grumm:hover {background-image: url("/avatars/e6b5c088068044df9e1b9bf11792291b?size=64&helm")} .avatar.grumm:hover {background-image: url("/avatars/e6b5c088068044df9e1b9bf11792291b?size=64&overlay")}
.avatar.themogmimer {background-image: url("/avatars/1c1bd09a6a0f4928a7914102a35d2670?size=64")} .avatar.themogmimer {background-image: url("/avatars/1c1bd09a6a0f4928a7914102a35d2670?size=64")}
.avatar.themogmimer:hover {background-image: url("/avatars/1c1bd09a6a0f4928a7914102a35d2670?size=64&helm")} .avatar.themogmimer:hover {background-image: url("/avatars/1c1bd09a6a0f4928a7914102a35d2670?size=64&overlay")}
.avatar.marc {background-image: url("/avatars/b05881186e75410db2db4d3066b223f7?size=64")} .avatar.marc {background-image: url("/avatars/b05881186e75410db2db4d3066b223f7?size=64")}
.avatar.marc:hover {background-image: url("/avatars/b05881186e75410db2db4d3066b223f7?size=64&helm")} .avatar.marc:hover {background-image: url("/avatars/b05881186e75410db2db4d3066b223f7?size=64&overlay")}
.avatar.searge {background-image: url("/avatars/696a82ce41f44b51aa31b8709b8686f0?size=64")} .avatar.searge {background-image: url("/avatars/696a82ce41f44b51aa31b8709b8686f0?size=64")}
.avatar.searge:hover {background-image: url("/avatars/696a82ce41f44b51aa31b8709b8686f0?size=64&helm")} .avatar.searge:hover {background-image: url("/avatars/696a82ce41f44b51aa31b8709b8686f0?size=64&overlay")}
.avatar.xlson {background-image: url("/avatars/b9583ca43e64488a9c8c4ab27e482255?size=64")} .avatar.xlson {background-image: url("/avatars/b9583ca43e64488a9c8c4ab27e482255?size=64")}
.avatar.xlson:hover {background-image: url("/avatars/b9583ca43e64488a9c8c4ab27e482255?size=64&helm")} .avatar.xlson:hover {background-image: url("/avatars/b9583ca43e64488a9c8c4ab27e482255?size=64&overlay")}
.avatar.minecraftchick {background-image: url("/avatars/c9b54008fd8047428b238787b5f2401c?size=64")} .avatar.minecraftchick {background-image: url("/avatars/c9b54008fd8047428b238787b5f2401c?size=64")}
.avatar.minecraftchick:hover {background-image: url("/avatars/c9b54008fd8047428b238787b5f2401c?size=64&helm")} .avatar.minecraftchick:hover {background-image: url("/avatars/c9b54008fd8047428b238787b5f2401c?size=64&overlay")}
.avatar.kappe {background-image: url("/avatars/d8f9a4340f2d415f9acfcd70341c75ec?size=64")} .avatar.kappe {background-image: url("/avatars/d8f9a4340f2d415f9acfcd70341c75ec?size=64")}
.avatar.kappe:hover {background-image: url("/avatars/d8f9a4340f2d415f9acfcd70341c75ec?size=64&helm")} .avatar.kappe:hover {background-image: url("/avatars/d8f9a4340f2d415f9acfcd70341c75ec?size=64&overlay")}
.avatar.krisjelbring {background-image: url("/avatars/7125ba8b1c864508b92bb5c042ccfe2b?size=64")} .avatar.krisjelbring {background-image: url("/avatars/7125ba8b1c864508b92bb5c042ccfe2b?size=64")}
.avatar.krisjelbring:hover {background-image: url("/avatars/7125ba8b1c864508b92bb5c042ccfe2b?size=64&helm")} .avatar.krisjelbring:hover {background-image: url("/avatars/7125ba8b1c864508b92bb5c042ccfe2b?size=64&overlay")}
.avatar.thinkofdeath {background-image: url("/avatars/4566e69fc90748ee8d71d7ba5aa00d20?size=64")} .avatar.thinkofdeath {background-image: url("/avatars/4566e69fc90748ee8d71d7ba5aa00d20?size=64")}
.avatar.thinkofdeath:hover {background-image: url("/avatars/4566e69fc90748ee8d71d7ba5aa00d20?size=64&helm")} .avatar.thinkofdeath:hover {background-image: url("/avatars/4566e69fc90748ee8d71d7ba5aa00d20?size=64&overlay")}
.avatar.evilseph {background-image: url("/avatars/020242a17b9441799eff511eea1221da?size=64")} .avatar.evilseph {background-image: url("/avatars/020242a17b9441799eff511eea1221da?size=64")}
.avatar.evilseph:hover {background-image: url("/avatars/020242a17b9441799eff511eea1221da?size=64&helm")} .avatar.evilseph:hover {background-image: url("/avatars/020242a17b9441799eff511eea1221da?size=64&overlay")}
.avatar.mollstam {background-image: url("/avatars/9769ecf6331448f3ace67ae06cec64a3?size=64")} .avatar.mollstam {background-image: url("/avatars/9769ecf6331448f3ace67ae06cec64a3?size=64")}
.avatar.mollstam:hover {background-image: url("/avatars/9769ecf6331448f3ace67ae06cec64a3?size=64&helm")} .avatar.mollstam:hover {background-image: url("/avatars/9769ecf6331448f3ace67ae06cec64a3?size=64&overlay")}
.avatar.mollstam {background-image: url("/avatars/f8cdb6839e9043eea81939f85d9c5d69?size=64")} .avatar.mollstam {background-image: url("/avatars/f8cdb6839e9043eea81939f85d9c5d69?size=64")}
.avatar.mollstam:hover {background-image: url("/avatars/f8cdb6839e9043eea81939f85d9c5d69?size=64&helm")} .avatar.mollstam:hover {background-image: url("/avatars/f8cdb6839e9043eea81939f85d9c5d69?size=64&overlay")}
.avatar.flipped { .avatar.flipped {
-webkit-transform: rotate(180deg); -webkit-transform: rotate(180deg);

View File

@ -155,9 +155,9 @@ exp.draw_body = function(rid, skin_canvas, model_ctx, scale) {
// sets up the necessary components to draw the skin model // sets up the necessary components to draw the skin model
// uses the +img+ skin with options of drawing // uses the +img+ skin with options of drawing
// the +helm+ and the +body+ // the +overlay+ and the +body+
// callback: error, image buffer // callback: error, image buffer
exp.draw_model = function(rid, img, scale, helm, body, callback) { exp.draw_model = function(rid, img, scale, overlay, body, callback) {
var image = new Image(); var image = new Image();
image.onerror = function(err) { image.onerror = function(err) {
@ -180,7 +180,7 @@ exp.draw_model = function(rid, img, scale, helm, body, callback) {
exp.draw_body(rid, skin_canvas, model_ctx, scale); exp.draw_body(rid, skin_canvas, model_ctx, scale);
} }
exp.draw_head(skin_canvas, model_ctx, scale); exp.draw_head(skin_canvas, model_ctx, scale);
if (helm) { if (overlay) {
exp.draw_helmet(skin_canvas, model_ctx, scale); exp.draw_helmet(skin_canvas, model_ctx, scale);
} }

View File

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

View File

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

View File

@ -92,7 +92,7 @@
<div class="code"> <div class="code">
<%= domain %>/avatars/<mark class="green">uuid</mark> <%= domain %>/avatars/<mark class="green">uuid</mark>
</div> </div>
<p>Accepted <a href="#meta-parameters">modifiers</a>: <i><b>size</b>, <b>helm</b>, <b>default</b></i>.</p> <p>Accepted <a href="#meta-parameters">modifiers</a>: <i><b>size</b>, <b>overlay</b>, <b>default</b></i>.</p>
</div> </div>
</div> </div>
</section> </section>
@ -108,7 +108,7 @@
<%= domain %>/renders/head/<mark class="green">uuid</mark> <%= domain %>/renders/head/<mark class="green">uuid</mark>
</div> </div>
<p> <p>
Accepted <a href="#meta-parameters">modifiers</a>: <i><b>scale</b>, <b>helm</b>, <b>default</b></i>.<br> Accepted <a href="#meta-parameters">modifiers</a>: <i><b>scale</b>, <b>overlay</b>, <b>default</b></i>.<br>
Please note that renders are still beta and have some issues. New renders are <a href="https://github.com/crafatar/crafatar/pull/134" target="_blank">in progress</a>! Please note that renders are still beta and have some issues. New renders are <a href="https://github.com/crafatar/crafatar/pull/134" target="_blank">in progress</a>!
</p> </p>
</div> </div>
@ -126,7 +126,7 @@
<%= domain %>/renders/body/<mark class="green">uuid</mark> <%= domain %>/renders/body/<mark class="green">uuid</mark>
</div> </div>
<p> <p>
Accepted <a href="#meta-parameters">modifiers</a>: <i><b>scale</b>, <b>helm</b>, <b>default</b></i>.<br> Accepted <a href="#meta-parameters">modifiers</a>: <i><b>scale</b>, <b>overlay</b>, <b>default</b></i>.<br>
Please note that renders are still beta and have some issues. New renders are <a href="https://github.com/crafatar/crafatar/pull/134" target="_blank">in progress</a>! Please note that renders are still beta and have some issues. New renders are <a href="https://github.com/crafatar/crafatar/pull/134" target="_blank">in progress</a>!
</p> </p>
</div> </div>
@ -187,12 +187,12 @@
<h3><a href="#meta-parameters">URL Parameters</a></h3> <h3><a href="#meta-parameters">URL Parameters</a></h3>
<p> <p>
You can tweak images using <a href="https://en.wikipedia.org/wiki/Query_string" target="_blank">query string parameters</a>.<br> You can tweak images using <a href="https://en.wikipedia.org/wiki/Query_string" target="_blank">query string parameters</a>.<br>
Example: <code><%= domain %>/avatars/853c80ef3c3749fdaa49938b674adae6<mark class="blue">?</mark><mark class="green">size=4</mark><mark class="blue">&</mark><mark class="green">default=MHF_Steve</mark><mark class="blue">&</mark><mark class="green">helm</mark></code> Example: <code><%= domain %>/avatars/853c80ef3c3749fdaa49938b674adae6<mark class="blue">?</mark><mark class="green">size=4</mark><mark class="blue">&</mark><mark class="green">default=MHF_Steve</mark><mark class="blue">&</mark><mark class="green">overlay</mark></code>
</p> </p>
<ul> <ul>
<li><b>size</b>: The size of the image in pixels. <code><%= config.avatars.min_size %> - <%= config.avatars.max_size %></code> <li><b>size</b>: The size of the image in pixels. <code><%= config.avatars.min_size %> - <%= config.avatars.max_size %></code>
<li><b>scale</b>: The scale factor for renders. <code><%= config.renders.min_scale %> - <%= config.renders.max_scale %></code> <li><b>scale</b>: The scale factor for renders. <code><%= config.renders.min_scale %> - <%= config.renders.max_scale %></code>
<li><b>helm</b>: Apply the <span title="Also known as 'hat' or 'jacket' or 'helm'">overlay</span> to the avatar. Presence of this parameter implies <code>true</code>. <li><b>overlay</b>: Apply the <span title="Also known as 'hat' or 'jacket' or 'helm'">overlay</span> to the avatar. Presence of this parameter implies <code>true</code>. This option was previously known as <code>helm</code>.
<li> <li>
<b>default</b>: The fallback to be used when the requested image cannot be served. You can use a <span title="Make sure to properly percent-encode this!">custom URL</span> or any <mark class="green">uuid</mark>.<br> <b>default</b>: The fallback to be used when the requested image cannot be served. You can use a <span title="Make sure to properly percent-encode this!">custom URL</span> or any <mark class="green">uuid</mark>.<br>
The option defaults to either <code>MHF_Steve</code> or <code>MHF_Alex</code>, depending on the requested UUID. All usernames default to <code>MHF_Steve</code>. The option defaults to either <code>MHF_Steve</code> or <code>MHF_Alex</code>, depending on the requested UUID. All usernames default to <code>MHF_Steve</code>.

View File

@ -25,9 +25,9 @@ bulk() {
trap return INT trap return INT
echo "$ids" | while read id; do echo "$ids" | while read id; do
if [ -z "$async" ]; then if [ -z "$async" ]; then
curl -sSL -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" -- "$host/avatars/$id?helm" curl -sSL -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" -- "$host/avatars/$id?overlay"
else else
curl -sSL -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" -- "$host/avatars/$id?helm" & curl -sSL -o /dev/null -w "%{url_effective} %{http_code} %{time_total}s\\n" -- "$host/avatars/$id?overlay" &
sleep "$interval" sleep "$interval"
fi fi
done done

View File

@ -366,33 +366,33 @@ describe("Crafatar", function() {
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
"helm avatar with existing username": { "overlay avatar with existing username": {
url: "http://localhost:3000/avatars/jeb_?size=16&helm", url: "http://localhost:3000/avatars/jeb_?size=16&overlay",
etag: '"a846b82963"', etag: '"a846b82963"',
crc32: 646871998 crc32: 646871998
}, },
"helm avatar with non-existent username": { "overlay avatar with non-existent username": {
url: "http://localhost:3000/avatars/0?size=16&helm", url: "http://localhost:3000/avatars/0?size=16&overlay",
etag: '"mhf_steve"', etag: '"mhf_steve"',
crc32: [2416827277, 1243826040] crc32: [2416827277, 1243826040]
}, },
"helm avatar with non-existent username defaulting to alex": { "overlay avatar with non-existent username defaulting to alex": {
url: "http://localhost:3000/avatars/0?size=16&helm&default=mhf_alex", url: "http://localhost:3000/avatars/0?size=16&overlay&default=mhf_alex",
etag: '"mhf_alex"', etag: '"mhf_alex"',
crc32: [862751081, 809395677] crc32: [862751081, 809395677]
}, },
"helm avatar with non-existent username defaulting to username": { "overlay avatar with non-existent username defaulting to username": {
url: "http://localhost:3000/avatars/0?size=16&helm&default=jeb_", url: "http://localhost:3000/avatars/0?size=16&overlay&default=jeb_",
crc32: 0, crc32: 0,
redirect: "/avatars/jeb_?size=16&helm=" redirect: "/avatars/jeb_?size=16&overlay="
}, },
"helm avatar with non-existent username defaulting to uuid": { "overlay avatar with non-existent username defaulting to uuid": {
url: "http://localhost:3000/avatars/0?size=16&helm&default=853c80ef3c3749fdaa49938b674adae6", url: "http://localhost:3000/avatars/0?size=16&overlay&default=853c80ef3c3749fdaa49938b674adae6",
crc32: 0, crc32: 0,
redirect: "/avatars/853c80ef3c3749fdaa49938b674adae6?size=16&helm=" redirect: "/avatars/853c80ef3c3749fdaa49938b674adae6?size=16&overlay="
}, },
"helm avatar with non-existent username defaulting to url": { "overlay avatar with non-existent username defaulting to url": {
url: "http://localhost:3000/avatars/0?size=16&helm&default=http%3A%2F%2Fexample.com%2FCaseSensitive", url: "http://localhost:3000/avatars/0?size=16&overlay&default=http%3A%2F%2Fexample.com%2FCaseSensitive",
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
@ -426,33 +426,33 @@ describe("Crafatar", function() {
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
"helm avatar with existing uuid": { "overlay avatar with existing uuid": {
url: "http://localhost:3000/avatars/853c80ef3c3749fdaa49938b674adae6?size=16&helm", url: "http://localhost:3000/avatars/853c80ef3c3749fdaa49938b674adae6?size=16&overlay",
etag: '"a846b82963"', etag: '"a846b82963"',
crc32: 646871998 crc32: 646871998
}, },
"helm avatar with non-existent uuid": { "overlay avatar with non-existent uuid": {
url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&helm", url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&overlay",
etag: '"mhf_steve"', etag: '"mhf_steve"',
crc32: [2416827277, 1243826040] crc32: [2416827277, 1243826040]
}, },
"helm avatar with non-existent uuid defaulting to alex": { "overlay avatar with non-existent uuid defaulting to alex": {
url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&helm&default=mhf_alex", url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&overlay&default=mhf_alex",
etag: '"mhf_alex"', etag: '"mhf_alex"',
crc32: [862751081, 809395677] crc32: [862751081, 809395677]
}, },
"helm avatar with non-existent uuid defaulting to username": { "overlay avatar with non-existent uuid defaulting to username": {
url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&default=jeb_", url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&default=jeb_",
crc32: 0, crc32: 0,
redirect: "/avatars/jeb_?size=16" redirect: "/avatars/jeb_?size=16"
}, },
"helm avatar with non-existent uuid defaulting to uuid": { "overlay avatar with non-existent uuid defaulting to uuid": {
url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&default=853c80ef3c3749fdaa49938b674adae6", url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&default=853c80ef3c3749fdaa49938b674adae6",
crc32: 0, crc32: 0,
redirect: "/avatars/853c80ef3c3749fdaa49938b674adae6?size=16" redirect: "/avatars/853c80ef3c3749fdaa49938b674adae6?size=16"
}, },
"helm avatar with non-existent uuid defaulting to url": { "overlay avatar with non-existent uuid defaulting to url": {
url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&helm&default=http%3A%2F%2Fexample.com%2FCaseSensitive", url: "http://localhost:3000/avatars/00000000000000000000000000000000?size=16&overlay&default=http%3A%2F%2Fexample.com%2FCaseSensitive",
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
@ -574,33 +574,33 @@ describe("Crafatar", function() {
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
"helm head render with existing username": { "overlay head render with existing username": {
url: "http://localhost:3000/renders/head/jeb_?scale=2&helm", url: "http://localhost:3000/renders/head/jeb_?scale=2&overlay",
etag: '"a846b82963"', etag: '"a846b82963"',
crc32: [4178514320, 2340078566, 3980890516] crc32: [4178514320, 2340078566, 3980890516]
}, },
"helm head render with non-existent username": { "overlay head render with non-existent username": {
url: "http://localhost:3000/renders/head/0?scale=2&helm", url: "http://localhost:3000/renders/head/0?scale=2&overlay",
etag: '"mhf_steve"', etag: '"mhf_steve"',
crc32: [507497693, 3868868707, 7372195] crc32: [507497693, 3868868707, 7372195]
}, },
"helm head render with non-existent username defaulting to alex": { "overlay head render with non-existent username defaulting to alex": {
url: "http://localhost:3000/renders/head/0?scale=2&helm&default=mhf_alex", url: "http://localhost:3000/renders/head/0?scale=2&overlay&default=mhf_alex",
etag: '"mhf_alex"', etag: '"mhf_alex"',
crc32: [891113664, 1785326216, 622500655] crc32: [891113664, 1785326216, 622500655]
}, },
"helm head render with non-existent username defaulting to username": { "overlay head render with non-existent username defaulting to username": {
url: "http://localhost:3000/renders/head/0?scale=2&helm&default=jeb_", url: "http://localhost:3000/renders/head/0?scale=2&overlay&default=jeb_",
crc32: 0, crc32: 0,
redirect: "/renders/head/jeb_?scale=2&helm=" redirect: "/renders/head/jeb_?scale=2&overlay="
}, },
"helm head render with non-existent username defaulting to uuid": { "overlay head render with non-existent username defaulting to uuid": {
url: "http://localhost:3000/renders/head/0?scale=2&helm&default=853c80ef3c3749fdaa49938b674adae6", url: "http://localhost:3000/renders/head/0?scale=2&overlay&default=853c80ef3c3749fdaa49938b674adae6",
crc32: 0, crc32: 0,
redirect: "/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=2&helm=" redirect: "/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=2&overlay="
}, },
"helm head render with non-existent username defaulting to url": { "overlay head render with non-existent username defaulting to url": {
url: "http://localhost:3000/renders/head/0?scale=2&helm&default=http%3A%2F%2Fexample.com%2FCaseSensitive", url: "http://localhost:3000/renders/head/0?scale=2&overlay&default=http%3A%2F%2Fexample.com%2FCaseSensitive",
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
@ -634,33 +634,33 @@ describe("Crafatar", function() {
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
"helm head render with existing uuid": { "overlay head render with existing uuid": {
url: "http://localhost:3000/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=2&helm", url: "http://localhost:3000/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=2&overlay",
etag: '"a846b82963"', etag: '"a846b82963"',
crc32: [4178514320, 2340078566, 3980890516] crc32: [4178514320, 2340078566, 3980890516]
}, },
"helm head render with non-existent uuid": { "overlay head render with non-existent uuid": {
url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&helm", url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&overlay",
etag: '"mhf_steve"', etag: '"mhf_steve"',
crc32: [507497693, 3868868707, 7372195] crc32: [507497693, 3868868707, 7372195]
}, },
"helm head render with non-existent uuid defaulting to alex": { "overlay head render with non-existent uuid defaulting to alex": {
url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&helm&default=mhf_alex", url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&overlay&default=mhf_alex",
etag: '"mhf_alex"', etag: '"mhf_alex"',
crc32: [891113664, 1785326216, 622500655] crc32: [891113664, 1785326216, 622500655]
}, },
"helm head with non-existent uuid defaulting to username": { "overlay head with non-existent uuid defaulting to username": {
url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&helm&default=jeb_", url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&overlay&default=jeb_",
crc32: 0, crc32: 0,
redirect: "/renders/head/jeb_?scale=2&helm=" redirect: "/renders/head/jeb_?scale=2&overlay="
}, },
"helm head with non-existent uuid defaulting to uuid": { "overlay head with non-existent uuid defaulting to uuid": {
url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&helm&default=853c80ef3c3749fdaa49938b674adae6", url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&overlay&default=853c80ef3c3749fdaa49938b674adae6",
crc32: 0, crc32: 0,
redirect: "/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=2&helm=" redirect: "/renders/head/853c80ef3c3749fdaa49938b674adae6?scale=2&overlay="
}, },
"helm head render with non-existent uuid defaulting to url": { "overlay head render with non-existent uuid defaulting to url": {
url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&helm&default=http%3A%2F%2Fexample.com%2FCaseSensitive", url: "http://localhost:3000/renders/head/00000000000000000000000000000000?scale=2&overlay&default=http%3A%2F%2Fexample.com%2FCaseSensitive",
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
@ -694,33 +694,33 @@ describe("Crafatar", function() {
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
"helm body render with existing username": { "overlay body render with existing username": {
url: "http://localhost:3000/renders/body/jeb_?scale=2&helm", url: "http://localhost:3000/renders/body/jeb_?scale=2&overlay",
etag: '"a846b82963"', etag: '"a846b82963"',
crc32: [3476579592, 97705180, 3086172613] crc32: [3476579592, 97705180, 3086172613]
}, },
"helm body render with non-existent username": { "overlay body render with non-existent username": {
url: "http://localhost:3000/renders/body/0?scale=2&helm", url: "http://localhost:3000/renders/body/0?scale=2&overlay",
etag: '"mhf_steve"', etag: '"mhf_steve"',
crc32: [3992841063, 1025743887, 1906839968] crc32: [3992841063, 1025743887, 1906839968]
}, },
"helm body render with non-existent username defaulting to alex": { "overlay body render with non-existent username defaulting to alex": {
url: "http://localhost:3000/renders/body/0?scale=2&helm&default=mhf_alex", url: "http://localhost:3000/renders/body/0?scale=2&overlay&default=mhf_alex",
etag: '"mhf_alex"', etag: '"mhf_alex"',
crc32: [3317518715, 3621585514, 294661951] crc32: [3317518715, 3621585514, 294661951]
}, },
"helm body render with non-existent username defaulting to username": { "overlay body render with non-existent username defaulting to username": {
url: "http://localhost:3000/renders/body/0?scale=2&helm&default=jeb_", url: "http://localhost:3000/renders/body/0?scale=2&overlay&default=jeb_",
crc32: 0, crc32: 0,
redirect: "/renders/body/jeb_?scale=2&helm=" redirect: "/renders/body/jeb_?scale=2&overlay="
}, },
"helm body render with non-existent username defaulting to uuid": { "overlay body render with non-existent username defaulting to uuid": {
url: "http://localhost:3000/renders/body/0?scale=2&helm&default=853c80ef3c3749fdaa49938b674adae6", url: "http://localhost:3000/renders/body/0?scale=2&overlay&default=853c80ef3c3749fdaa49938b674adae6",
crc32: 0, crc32: 0,
redirect: "/renders/body/853c80ef3c3749fdaa49938b674adae6?scale=2&helm=" redirect: "/renders/body/853c80ef3c3749fdaa49938b674adae6?scale=2&overlay="
}, },
"helm body render with non-existent username defaulting to url": { "overlay body render with non-existent username defaulting to url": {
url: "http://localhost:3000/renders/body/0?scale=2&helm&default=http%3A%2F%2Fexample.com%2FCaseSensitive", url: "http://localhost:3000/renders/body/0?scale=2&overlay&default=http%3A%2F%2Fexample.com%2FCaseSensitive",
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
@ -754,23 +754,23 @@ describe("Crafatar", function() {
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },
"helm body render with existing uuid": { "overlay body render with existing uuid": {
url: "http://localhost:3000/renders/body/853c80ef3c3749fdaa49938b674adae6?scale=2&helm", url: "http://localhost:3000/renders/body/853c80ef3c3749fdaa49938b674adae6?scale=2&overlay",
etag: '"a846b82963"', etag: '"a846b82963"',
crc32: [3476579592, 97705180, 3086172613] crc32: [3476579592, 97705180, 3086172613]
}, },
"helm body render with non-existent uuid": { "overlay body render with non-existent uuid": {
url: "http://localhost:3000/renders/body/00000000000000000000000000000000?scale=2&helm", url: "http://localhost:3000/renders/body/00000000000000000000000000000000?scale=2&overlay",
etag: '"mhf_steve"', etag: '"mhf_steve"',
crc32: [3992841063, 1025743887, 1906839968] crc32: [3992841063, 1025743887, 1906839968]
}, },
"helm body render with non-existent uuid defaulting to alex": { "overlay body render with non-existent uuid defaulting to alex": {
url: "http://localhost:3000/renders/body/00000000000000000000000000000000?scale=2&helm&default=mhf_alex", url: "http://localhost:3000/renders/body/00000000000000000000000000000000?scale=2&overlay&default=mhf_alex",
etag: '"mhf_alex"', etag: '"mhf_alex"',
crc32: [3317518715, 3621585514, 294661951] crc32: [3317518715, 3621585514, 294661951]
}, },
"helm body render with non-existent uuid defaulting to url": { "overlay body render with non-existent uuid defaulting to url": {
url: "http://localhost:3000/renders/body/00000000000000000000000000000000?scale=2&helm&default=http%3A%2F%2Fexample.com%2FCaseSensitive", url: "http://localhost:3000/renders/body/00000000000000000000000000000000?scale=2&overlay&default=http%3A%2F%2Fexample.com%2FCaseSensitive",
crc32: 0, crc32: 0,
redirect: "http://example.com/CaseSensitive" redirect: "http://example.com/CaseSensitive"
}, },