@@ -26,7 +26,8 @@ | |||
}, | |||
"debug": false, | |||
"max_runs": 9999, | |||
"cache_max_age": 604800, | |||
"cache_max_age": 2628000, | |||
"cache_max_age_images": 2628000, | |||
"purge_collections_timeout": "2 days", | |||
"purge_collections_interval": 1800000 | |||
} |
@@ -40,6 +40,7 @@ var endpoints = { | |||
//Viewer | |||
"/view": "view/index.node.js", | |||
"/view/style.css": "view/style.css", | |||
"/view/script.js": "view/script.js", | |||
//Plain images | |||
"/i": "i/index.node.js", | |||
@@ -92,7 +93,7 @@ function onRequest(req, res) { | |||
var ep = loaded.endpoints[req.url.split("?")[0]]; | |||
//If the file doesn't exist, we 404. | |||
if (!ep) { | |||
if (ep === undefined) { | |||
ep = loaded.endpoints["/404"]; | |||
ctx.setStatus(404); | |||
} |
@@ -6,7 +6,7 @@ | |||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |||
<link rel="stylesheet" href="/{{env#view}}/style.css?{{conf#currentRun}}"> | |||
<script src="https://code.jquery.com/jquery-2.1.4.js"></script> | |||
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> | |||
<script src="/global.js?{{conf#currentRun}}"></script> | |||
<script src="/{{env#view}}/script.js?{{conf#currentRun}}"></script> |
@@ -5,6 +5,11 @@ module.exports = function(ctx) { | |||
if (!id) | |||
return ctx.end(ctx.view("404")); | |||
ctx.res.setHeader( | |||
"Cache-Control", | |||
"public, max-age="+ctx.conf.cache_max_age_images | |||
); | |||
var readStream = fs.createReadStream(ctx.conf.dir.imgs+"/"+id); | |||
readStream.pipe(ctx.res); | |||