mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
support redirection for capes
This commit is contained in:
parent
5c53694f9d
commit
4286b35775
@ -5,6 +5,7 @@ var cache = require("../cache");
|
||||
// GET cape request
|
||||
module.exports = function(req, callback) {
|
||||
var userId = (req.url.pathname.split("/")[2] || "").split(".")[0];
|
||||
var def = req.url.query.default;
|
||||
var rid = req.id;
|
||||
|
||||
if (!helpers.id_valid(userId)) {
|
||||
@ -31,6 +32,7 @@ module.exports = function(req, callback) {
|
||||
status: status,
|
||||
body: image,
|
||||
type: image ? "image/png" : undefined,
|
||||
redirect: image ? undefined : def,
|
||||
hash: hash,
|
||||
err: err
|
||||
});
|
||||
|
||||
@ -381,10 +381,6 @@ describe("Crafatar", function() {
|
||||
url: "http://localhost:3000/capes/0",
|
||||
crc32: 0
|
||||
},
|
||||
"cape with not existing username defaulting to alex": {
|
||||
url: "http://localhost:3000/capes/0?default=alex",
|
||||
crc32: 0
|
||||
},
|
||||
"cape with not existing username defaulting to url": {
|
||||
url: "http://localhost:3000/capes/0?default=http://example.com",
|
||||
crc32: 0,
|
||||
@ -399,10 +395,6 @@ describe("Crafatar", function() {
|
||||
url: "http://localhost:3000/capes/00000000000000000000000000000000",
|
||||
crc32: 0
|
||||
},
|
||||
"cape with not existing uuid defaulting to alex": {
|
||||
url: "http://localhost:3000/capes/00000000000000000000000000000000?default=alex",
|
||||
crc32: 0
|
||||
},
|
||||
"cape with not existing uuid defaulting to url": {
|
||||
url: "http://localhost:3000/capes/00000000000000000000000000000000?default=http://example.com",
|
||||
crc32: 0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user