aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-10-01 22:02:29 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-10-01 22:03:58 -1000
commitfc800407c0f45352ee533769fe96a8c339501a34 (patch)
tree7d2e79100906480c23de4e9ad3eaa0052f818020 /lib/serve.js
parent7ef25848b38465fe70b65ab91bf905ae927d4d7c (diff)
downloadpatchfoo-fc800407c0f45352ee533769fe96a8c339501a34.tar.gz
patchfoo-fc800407c0f45352ee533769fe96a8c339501a34.zip
Decrypt message with unbox key query parameter
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/serve.js b/lib/serve.js
index f825ed7..c51a331 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -3627,8 +3627,16 @@ Serve.prototype.getBuiltinEmojiLink = function (name) {
}
Serve.prototype.getMsgDecryptedMaybeOoo = function (key, cb) {
- if (this.useOoo) this.app.getMsgDecryptedOoo(key, cb)
- else this.app.getMsgDecrypted(key, cb)
+ var self = this
+ if (this.useOoo) this.app.getMsgDecryptedOoo(key, next)
+ else this.app.getMsgDecrypted(key, next)
+ function next(err, msg) {
+ if (err) return cb(err)
+ var c = msg && msg.value && msg.value.content
+ if (typeof c === 'string' && self.query.unbox)
+ self.app.unboxMsgWithKey(msg, String(self.query.unbox).replace(/ /g, '+'), cb)
+ else cb(null, msg)
+ }
}
Serve.prototype.emojis = function (path) {