Ver Fonte

clarify config options

jomo há 10 anos atrás
pai
commit
6eac9b907d
2 ficheiros alterados com 3 adições e 3 exclusões
  1. 2 2
      modules/config.js
  2. 1 1
      routes/avatars.js

+ 2 - 2
modules/config.js

@@ -1,8 +1,8 @@
 var config = {
 var config = {
-  min_size: 0,               // < 0 will (obviously) cause crash
+  min_size: 1,               // < 1 will (obviously) cause crash
   max_size: 512,             // too big values might lead to slow response time or DoS
   max_size: 512,             // 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,         // size to be used when no size given
-  local_cache_time: 3600,    // seconds until we will check if the image changed
+  local_cache_time: 3600,    // 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
   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 '/'

+ 1 - 1
routes/avatars.js

@@ -12,7 +12,7 @@ router.get('/:uuid.:ext?', function(req, res) {
   var start = new Date();
   var start = new Date();
 
 
   // Prevent app from crashing/freezing
   // Prevent app from crashing/freezing
-  if (size <= config.min_size || size > config.max_size) {
+  if (size < config.min_size || size > config.max_size) {
     // "Unprocessable Entity", valid request, but semantically erroneous:
     // "Unprocessable Entity", valid request, but semantically erroneous:
     // https://tools.ietf.org/html/rfc4918#page-78
     // https://tools.ietf.org/html/rfc4918#page-78
     res.status(422).send("422 Invalid size");
     res.status(422).send("422 Invalid size");