index.jsView |
---|
92 | 92 … | |
93 | 93 … | function serveFeed(req, res, feedId) { |
94 | 94 … | console.log("serving feed: " + feedId) |
95 | 95 … | |
| 96 … | + var showAll = req.url.endsWith("?showAll") |
| 97 … | + var showAllHTML = showAll ? '' : '<br/><a href="' + req.url + '?showAll">Show whole feed</a>' |
| 98 … | + |
96 | 99 … | getAbout(feedId, function (err, about) { |
97 | | - if (err) return respond(res, 500, err.stack || err) |
| 100 … | + if (err) return respond(res, 500, err.stack || err) |
98 | 101 … | |
99 | 102 … | pull( |
100 | | - sbot.createUserStream({ id: feedId, reverse: true }), |
| 103 … | + sbot.createUserStream({ id: feedId, reverse: true, limit: showAll ? -1 : 10 }), |
101 | 104 … | pull.collect(function (err, logs) { |
102 | 105 … | if (err) return respond(res, 500, err.stack || err) |
103 | 106 … | res.writeHead(200, { |
104 | 107 … | 'Content-Type': ctype("html") |
108 | 111 … | paramap(addAuthorAbout, 8), |
109 | 112 … | paramap(addFollowAbout, 8), |
110 | 113 … | paramap(addVoteMessage, 8), |
111 | 114 … | paramap(addGitLinks, 8), |
112 | | - pull(renderAbout(defaultOpts, about), wrapPage(about.name)), |
| 115 … | + pull(renderAbout(defaultOpts, about, showAllHTML), wrapPage(about.name)), |
113 | 116 … | toPull(res, function (err) { |
114 | 117 … | if (err) console.error('[viewer]', err) |
115 | 118 … | }) |
116 | 119 … | ) |
190 | 193 … | |
191 | 194 … | function serveChannel(req, res, url) { |
192 | 195 … | var channelId = url.substring(url.lastIndexOf('channel/')+8, 100) |
193 | 196 … | console.log("serving channel: " + channelId) |
| 197 … | + |
| 198 … | + var showAll = req.url.endsWith("?showAll") |
| 199 … | + var showAllHTML = showAll ? '' : '<br/><a href="' + req.url + '?showAll">Show whole feed</a>' |
194 | 200 … | |
195 | 201 … | pull( |
196 | | - sbot.query.read({ limit: 500, reverse: true, query: [{$filter: { value: { content: { channel: channelId }}}}]}), |
| 202 … | + sbot.query.read({ limit: showAll ? 300 : 10, reverse: true, query: [{$filter: { value: { content: { channel: channelId }}}}]}), |
197 | 203 … | pull.collect(function (err, logs) { |
198 | 204 … | if (err) return respond(res, 500, err.stack || err) |
199 | 205 … | res.writeHead(200, { |
200 | 206 … | 'Content-Type': ctype("html") |
202 | 208 … | pull( |
203 | 209 … | pull.values(logs), |
204 | 210 … | paramap(addAuthorAbout, 8), |
205 | 211 … | paramap(addVoteMessage, 8), |
206 | | - pull(renderThread(defaultOpts), wrapPage('#' + channelId)), |
| 212 … | + pull(renderThread(defaultOpts, showAllHTML), wrapPage('#' + channelId)), |
207 | 213 … | toPull(res, function (err) { |
208 | 214 … | if (err) console.error('[viewer]', err) |
209 | 215 … | }) |
210 | 216 … | ) |