}, | }, | ||||
"debug": false, | "debug": false, | ||||
"max_runs": 9999, | "max_runs": 9999, | ||||
"cache_max_age": 604800, | |||||
"cache_max_age": 2628000, | |||||
"cache_max_age_images": 2628000, | |||||
"purge_collections_timeout": "2 days", | "purge_collections_timeout": "2 days", | ||||
"purge_collections_interval": 1800000 | "purge_collections_interval": 1800000 | ||||
} | } |
//Viewer | //Viewer | ||||
"/view": "view/index.node.js", | "/view": "view/index.node.js", | ||||
"/view/style.css": "view/style.css", | "/view/style.css": "view/style.css", | ||||
"/view/script.js": "view/script.js", | |||||
//Plain images | //Plain images | ||||
"/i": "i/index.node.js", | "/i": "i/index.node.js", | ||||
var ep = loaded.endpoints[req.url.split("?")[0]]; | var ep = loaded.endpoints[req.url.split("?")[0]]; | ||||
//If the file doesn't exist, we 404. | //If the file doesn't exist, we 404. | ||||
if (!ep) { | |||||
if (ep === undefined) { | |||||
ep = loaded.endpoints["/404"]; | ep = loaded.endpoints["/404"]; | ||||
ctx.setStatus(404); | ctx.setStatus(404); | ||||
} | } |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | <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}}"> | <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="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> | ||||
<script src="/global.js?{{conf#currentRun}}"></script> | <script src="/global.js?{{conf#currentRun}}"></script> | ||||
<script src="/{{env#view}}/script.js?{{conf#currentRun}}"></script> | <script src="/{{env#view}}/script.js?{{conf#currentRun}}"></script> |
if (!id) | if (!id) | ||||
return ctx.end(ctx.view("404")); | 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); | var readStream = fs.createReadStream(ctx.conf.dir.imgs+"/"+id); | ||||
readStream.pipe(ctx.res); | readStream.pipe(ctx.res); | ||||