mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
fix X-Storage-Type always returning local
This commit is contained in:
parent
87eb33bca8
commit
2d061246c4
@ -30,7 +30,7 @@ router.get('/:uuid', function(req, res) {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
handle_404(def);
|
handle_404(def);
|
||||||
} else if (status == 1 || status == 2) {
|
} else if (status == 1 || status == 2) {
|
||||||
sendimage(200, image);
|
sendimage(200, status == 1, image);
|
||||||
} else if (status == 3) {
|
} else if (status == 3) {
|
||||||
handle_404(def);
|
handle_404(def);
|
||||||
}
|
}
|
||||||
@ -44,19 +44,19 @@ router.get('/:uuid', function(req, res) {
|
|||||||
function handle_404(def) {
|
function handle_404(def) {
|
||||||
if (def == "alex" || def == "steve") {
|
if (def == "alex" || def == "steve") {
|
||||||
skins.resize_img("public/images/" + def + ".png", size, function(err, image) {
|
skins.resize_img("public/images/" + def + ".png", size, function(err, image) {
|
||||||
sendimage(404, image);
|
sendimage(404, true, image);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.status(404).send('404 Not found');
|
res.status(404).send('404 Not found');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendimage(status, image) {
|
function sendimage(status, local, image) {
|
||||||
res.writeHead(status, {
|
res.writeHead(status, {
|
||||||
'Content-Type': 'image/png',
|
'Content-Type': 'image/png',
|
||||||
'Cache-Control': 'max-age=' + config.browser_cache_time + ', public',
|
'Cache-Control': 'max-age=' + config.browser_cache_time + ', public',
|
||||||
'Response-Time': new Date() - start,
|
'Response-Time': new Date() - start,
|
||||||
'X-Storage-Type': 'local'
|
'X-Storage-Type': local ? 'local' : 'downloaded'
|
||||||
});
|
});
|
||||||
res.end(image);
|
res.end(image);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user