Commit 8c84e9ec8dfd1770ec8755f993ae9deea4aab61a
Fix showAll
Anders Rune Jensen committed on 1/12/2018, 12:21:04 AMParent: 07dd6934bb87b5461859bed91c1e7761f254db75
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -111,10 +111,9 @@ | |||
111 | 111 … | ) | |
112 | 112 … | }) | |
113 | 113 … | } | |
114 | 114 … | ||
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) { | ||
117 | 116 … | console.log("serving user feed: " + feedId) | |
118 | 117 … | ||
119 | 118 … | var following = [] | |
120 | 119 … | var channelSubscriptions = [] | |
@@ -187,14 +186,13 @@ | |||
187 | 186 … | }) | |
188 | 187 … | ) | |
189 | 188 … | } | |
190 | 189 … | ||
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) { | ||
193 | 191 … | console.log("serving channel: " + channelId) | |
194 | 192 … | ||
195 | 193 … | var showAll = req.url.endsWith("?showAll") | |
196 | - | ||
194 … | + | ||
197 | 195 … | pull( | |
198 | 196 … | sbot.query.read({ limit: showAll ? 300 : 10, reverse: true, | |
199 | 197 … | query: [{$filter: { value: { content: { channel: channelId }}}}]}), | |
200 | 198 … | pull.collect(function (err, logs) { | |
@@ -339,10 +337,12 @@ | |||
339 | 337 … | } | |
340 | 338 … | ||
341 | 339 … | var m = urlIdRegex.exec(req.url) | |
342 | 340 … | ||
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)) | ||
345 | 345 … | else if (req.url.startsWith('/.well-known/acme-challenge')) return serveAcmeChallenge(req, res) | |
346 | 346 … | ||
347 | 347 … | if (m[2] && m[2].length === 3) { | |
348 | 348 … | m[1] = decodeURIComponent(m[1]) |
Built with git-ssb-web