git ssb

9+

cel / ssb-viewer



Commit 8c84e9ec8dfd1770ec8755f993ae9deea4aab61a

Fix showAll

Anders Rune Jensen committed on 1/12/2018, 12:21:04 AM
Parent: 07dd6934bb87b5461859bed91c1e7761f254db75

Files changed

index.jschanged
index.jsView
@@ -111,10 +111,9 @@
111111 )
112112 })
113113 }
114114
115- exports.serveUserFeed = function(req, res) {
116- var feedId = req.url.substring(req.url.lastIndexOf('user-feed/')+10, 100)
115 + exports.serveUserFeed = function(req, res, feedId) {
117116 console.log("serving user feed: " + feedId)
118117
119118 var following = []
120119 var channelSubscriptions = []
@@ -187,14 +186,13 @@
187186 })
188187 )
189188 }
190189
191- exports.serveChannel = function(req, res) {
192- var channelId = req.url.substring(req.url.lastIndexOf('channel/')+8, 100)
190 + exports.serveChannel = function(req, res, channelId) {
193191 console.log("serving channel: " + channelId)
194192
195193 var showAll = req.url.endsWith("?showAll")
196-
194 +
197195 pull(
198196 sbot.query.read({ limit: showAll ? 300 : 10, reverse: true,
199197 query: [{$filter: { value: { content: { channel: channelId }}}}]}),
200198 pull.collect(function (err, logs) {
@@ -339,10 +337,12 @@
339337 }
340338
341339 var m = urlIdRegex.exec(req.url)
342340
343- if (req.url.startsWith('/user-feed/')) return exports.serveUserFeed(req, res)
344- else if (req.url.startsWith('/channel/')) return exports.serveChannel(req, res)
341 + if (req.url.startsWith('/user-feed/'))
342 + return exports.serveUserFeed(req, res, m[4].substring(m[4].lastIndexOf('user-feed/')+10, 100))
343 + else if (req.url.startsWith('/channel/'))
344 + return exports.serveChannel(req, res, m[4].substring(m[4].lastIndexOf('channel/')+8, 100))
345345 else if (req.url.startsWith('/.well-known/acme-challenge')) return serveAcmeChallenge(req, res)
346346
347347 if (m[2] && m[2].length === 3) {
348348 m[1] = decodeURIComponent(m[1])

Built with git-ssb-web