Comparing version 3.0.0 to 3.1.0
@@ -0,1 +1,5 @@ | ||
2017/12/09 Version 3.1.0 | ||
- Minor tweaks/fixes to directory view | ||
- Add a mess of dotfiles to .npmignore | ||
2017/08/28 Version 3.0.0 | ||
@@ -2,0 +6,0 @@ - Lint ./lib/ ./example and ./test against airbnb modified to support node 4.x |
@@ -65,1 +65,2 @@ General format is: contributor, github handle, email. In some cases, the | ||
* Bradley Farias @bmeck <bradley.meck@gmail.com> | ||
* David Refoua @DRSDavidSoft <david@refoua.me> |
@@ -239,2 +239,3 @@ #! /usr/bin/env node | ||
const etag = generateEtag(stat, weakEtags); | ||
let cacheControl = cache; | ||
let stream = null; | ||
@@ -256,2 +257,9 @@ | ||
if (typeof cacheControl === 'function') { | ||
cacheControl = cache(pathname); | ||
} | ||
if (typeof cacheControl === 'number') { | ||
cacheControl = `max-age=${cacheControl}`; | ||
} | ||
if (range) { | ||
@@ -287,2 +295,5 @@ const total = stat.size; | ||
'Content-Type': contentType, | ||
'cache-control': cacheControl, | ||
'last-modified': lastModified, | ||
etag, | ||
}); | ||
@@ -294,15 +305,6 @@ fstream.pipe(res); | ||
// TODO: Helper for this, with default headers. | ||
res.setHeader('cache-control', cacheControl); | ||
res.setHeader('last-modified', lastModified); | ||
res.setHeader('etag', etag); | ||
if (typeof cache === 'function') { | ||
let requestSpecificCache = cache(pathname); | ||
if (typeof requestSpecificCache === 'number') { | ||
requestSpecificCache = `max-age=${requestSpecificCache}`; | ||
} | ||
res.setHeader('cache-control', requestSpecificCache); | ||
} else { | ||
res.setHeader('cache-control', cache); | ||
} | ||
// Return a 304 if necessary | ||
@@ -309,0 +311,0 @@ if (shouldReturn304(req, lastModified, etag)) { |
@@ -8,2 +8,3 @@ 'use strict'; | ||
let css = `i.icon { display: block; height: ${IMG_SIZE}px; width: ${IMG_SIZE}px; }\n`; | ||
css += 'table tr { white-space: nowrap; }\n'; | ||
css += 'td.perms {}\n'; | ||
@@ -15,3 +16,3 @@ css += 'td.file-size { text-align: right; padding-left: 1em; }\n'; | ||
css += `i.icon-${key} {\n`; | ||
css += ` background: url("data:image/png;base64,${icons[key]}");\n`; | ||
css += ` background-image: url("data:image/png;base64,${icons[key]}");\n`; | ||
css += '}\n\n'; | ||
@@ -18,0 +19,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"homepage": "https://github.com/jfhbrook/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
309448
26
1234