aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/serve.js b/lib/serve.js
index ca86533..e7d1695 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -25,11 +25,6 @@ var emojiDir = path.join(require.resolve('emoji-named-characters'), '../pngs')
var urlIdRegex = /^(?:\/+(([%&@]|%25)(?:[A-Za-z0-9\/+]|%2[Ff]|%2[Bb]){43}(?:=|%3D)\.(?:sha256|ed25519))(?:\.([^?]*))?|(\/.*?))(?:\?(.*))?$/
-function isMsgReadable(msg) {
- var c = msg && msg.value.content
- return typeof c === 'object' && c !== null
-}
-
function isMsgEncrypted(msg) {
var c = msg && msg.value.content
return typeof c === 'string'
@@ -323,8 +318,7 @@ Serve.prototype.private = function (ext) {
pull(
this.app.createLogStream(opts),
pull.filter(isMsgEncrypted),
- paramap(this.app.unboxMsg, 16),
- pull.filter(isMsgReadable),
+ this.app.unboxMessages(),
pull.take(limit),
this.renderThreadPaginated(opts, null, q),
this.wrapMessages(),
@@ -412,13 +406,7 @@ Serve.prototype.channels = function (ext) {
var self = this
pull(
- self.app.sbot.messagesByType({type: 'channel', reverse: true}),
- paramap(self.app.unboxMsg, 16),
- pull.map(function (msg) {
- var c = msg.value.content
- return c && c.channel
- }),
- pull.unique(),
+ self.app.streamChannels(),
paramap(function (channel, cb) {
var subscribed = false
cb(null, h('form', {method: 'post', action: ''},
@@ -565,7 +553,7 @@ Serve.prototype.id = function (id, ext) {
pull(
cat([pull.once(rootMsg), self.app.sbot.links({dest: id, values: true})]),
pull.unique('key'),
- paramap(self.app.unboxMsg, 16),
+ self.app.unboxMessages(),
pull.collect(function (err, links) {
if (err) return self.respond(500, err.stack || err)
pull(
@@ -1230,7 +1218,7 @@ Serve.prototype.composer = function (opts, cb) {
var msgContainer = h('table.ssb-msgs')
pull(
pull.once(msg),
- pull.asyncMap(self.app.unboxMsg),
+ self.app.unboxMessages(),
self.app.render.renderFeeds(raw),
pull.drain(function (el) {
msgContainer.appendChild(h('tbody', el))