aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-02-01 10:35:27 -0800
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-02-01 10:35:27 -0800
commit4f3840b0b2f765a02d8b90c8cb2e9270458b8ae2 (patch)
treead48f88ec83778072e796c3725bba16f0ae50954
parentd885b9ab9c1a7d5a624b9d122583d77d42eee076 (diff)
downloadpatchfoo-4f3840b0b2f765a02d8b90c8cb2e9270458b8ae2.tar.gz
patchfoo-4f3840b0b2f765a02d8b90c8cb2e9270458b8ae2.zip
Don't cache id pages
-rw-r--r--lib/serve.js13
1 files changed, 0 insertions, 13 deletions
diff --git a/lib/serve.js b/lib/serve.js
index e4d5911..44c2ca3 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -18,16 +18,9 @@ var pkg = require('../package')
module.exports = Serve
var emojiDir = path.join(require.resolve('emoji-named-characters'), '../pngs')
-var appHash = hash([fs.readFileSync(__filename)])
var urlIdRegex = /^(?:\/+(([%&@]|%25)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3D)\.(?:sha256|ed25519))(?:\.([^?]*))?|(\/.*?))(?:\?(.*))?$/
-function hash(arr) {
- return arr.reduce(function (hash, item) {
- return hash.update(String(item))
- }, crypto.createHash('sha256')).digest('base64')
-}
-
function isMsgReadable(msg) {
var c = msg && msg.value.content
return typeof c === 'object' && c !== null
@@ -263,8 +256,6 @@ Serve.prototype.vote = function (ext) {
Serve.prototype.rawId = function (id) {
var self = this
- var etag = hash([id, appHash, 'raw'])
- if (self.req.headers['if-none-match'] === etag) return self.respond(304)
self.app.getMsgDecrypted(id, function (err, msg) {
if (err) return pull(
@@ -276,7 +267,6 @@ Serve.prototype.rawId = function (id) {
self.renderRawMsgPage(id),
self.respondSink(200, {
'Content-Type': ctype('html'),
- 'etag': etag
})
)
})
@@ -336,8 +326,6 @@ Serve.prototype.id = function (id, ext) {
paramap(self.app.unboxMsg, 4),
pull.collect(function (err, links) {
if (err) return self.respond(500, err.stack || err)
- var etag = hash(sort.heads(links).concat(appHash, ext, qs))
- if (self.req.headers['if-none-match'] === etag) return self.respond(304)
pull(
pull.values(sort(links)),
self.renderThread(),
@@ -351,7 +339,6 @@ Serve.prototype.id = function (id, ext) {
self.wrapPage(id),
self.respondSink(200, {
'Content-Type': ctype(ext),
- 'etag': etag
})
)
})