mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-22 16:01:16 +01:00
fix config, use min_scale + max_scale
This commit is contained in:
parent
dd2ac9ee4e
commit
62e1994121
@ -1,20 +1,21 @@
|
|||||||
var config = {
|
var config = {
|
||||||
min_size: 1, // < 1 will (obviously) cause crash
|
min_size: 1, // for avatars
|
||||||
max_size: 512, // too big values might lead to slow response time or DoS
|
max_size: 512, // for avatars; too big values might lead to slow response time or DoS
|
||||||
default_size: 160, // size to be used when no size given
|
default_size: 160, // for avatars; size to be used when no size given
|
||||||
local_cache_time: 1200, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response
|
local_cache_time: 1200, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response
|
||||||
browser_cache_time: 3600, // seconds until browser will request image again
|
browser_cache_time: 3600, // seconds until browser will request image again
|
||||||
cleaning_interval: 1800, // seconds interval: deleting images if disk size at limit
|
cleaning_interval: 1800, // seconds interval: deleting images if disk size at limit
|
||||||
cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning
|
cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning
|
||||||
cleaning_amount: 50000, // amount of avatar (and their helm) files to clean
|
cleaning_amount: 50000, // amount of avatar (and their helm) files to clean
|
||||||
http_timeout: 1000, // ms until connection to mojang is dropped
|
http_timeout: 1000, // ms until connection to mojang is dropped
|
||||||
faces_dir: 'skins/faces/', // directory where faces are kept. should have trailing '/'
|
faces_dir: 'skins/faces/', // directory where faces are kept. should have trailing '/'
|
||||||
helms_dir: 'skins/helms/', // directory where helms are kept. should have trailing '/'
|
helms_dir: 'skins/helms/', // directory where helms are kept. should have trailing '/'
|
||||||
skins_dir: 'skins/skins/', // directory where skins are kept. should have trailing '/'
|
skins_dir: 'skins/skins/', // directory where skins are kept. should have trailing '/'
|
||||||
renders_dir: 'skins/renders/', // Directory where rendered skins are kept. should have trailing '/'
|
renders_dir: 'skins/renders/', // Directory where rendered skins are kept. should have trailing '/'
|
||||||
debug_enabled: false, // enables logging.debug
|
debug_enabled: false, // enables logging.debug
|
||||||
default_scale: 6, // the scale of rendered avatars
|
min_scale: 1, // for renders
|
||||||
maximum_scale: 10 // the maximum scale of rendered avatars
|
max_scale: 10, // for renders; too big values might lead to slow response time or DoS
|
||||||
|
default_scale: 6, // for renders; scale to be used when no scale given
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
@ -16,7 +16,7 @@ var human_status = {
|
|||||||
|
|
||||||
// valid types: head, body. helmet is query param
|
// valid types: head, body. helmet is query param
|
||||||
|
|
||||||
// The Type logic should be two separate GET
|
// The Type logic should be two separate GET
|
||||||
// functions once response methods are extracted
|
// functions once response methods are extracted
|
||||||
router.get('/:type/:uuid.:ext?', function(req, res) {
|
router.get('/:type/:uuid.:ext?', function(req, res) {
|
||||||
var raw_type = req.params.type;
|
var raw_type = req.params.type;
|
||||||
@ -35,7 +35,7 @@ router.get('/:type/:uuid.:ext?', function(req, res) {
|
|||||||
var start = new Date();
|
var start = new Date();
|
||||||
var etag = null;
|
var etag = null;
|
||||||
|
|
||||||
if (scale > config.maximum_scale) {
|
if (scale < config.min_scale || scale > config.max_scale) {
|
||||||
// Preventing from OOM crashes.
|
// Preventing from OOM crashes.
|
||||||
res.status(422).send("422 Invalid Size");
|
res.status(422).send("422 Invalid Size");
|
||||||
} else if (!helpers.uuid_valid(uuid)) {
|
} else if (!helpers.uuid_valid(uuid)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user