diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/serve.js | 13 |
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 }) ) }) |