git ssb

9+

cel / ssb-viewer



Commit 4f7d162bf1625d6dc4e8e518f55ee5d842d12bc2

Refactor

Anders Rune Jensen committed on 5/11/2017, 7:45:07 PM
Parent: 02bfe74c0273e98741997b1d9d8c28a583dffda2

Files changed

index.jschanged
index.jsView
@@ -46,8 +46,21 @@
4646 img_base: conf.img_base || base,
4747 emoji_base: conf.emoji_base || (base + 'emoji/'),
4848 }
4949
50 + defaultOpts.marked = {
51 + gfm: true,
52 + mentions: true,
53 + tables: true,
54 + breaks: true,
55 + pedantic: false,
56 + sanitize: true,
57 + smartLists: true,
58 + smartypants: false,
59 + emoji: renderEmoji,
60 + renderer: new MdRenderer(defaultOpts)
61 + }
62 +
5063 var getMsg = memo({cache: lru(100)}, getMsgWithValue, sbot)
5164 var getAbout = memo({cache: lru(100)}, require('./lib/about'), sbot)
5265
5366 http.createServer(serve).listen(port, host, function () {
@@ -80,21 +93,8 @@
8093 console.log("serving feed: " + feedId)
8194
8295 var opts = defaultOpts
8396
84- opts.marked = {
85- gfm: true,
86- mentions: true,
87- tables: true,
88- breaks: true,
89- pedantic: false,
90- sanitize: true,
91- smartLists: true,
92- smartypants: false,
93- emoji: renderEmoji,
94- renderer: new MdRenderer(opts)
95- }
96-
9797 getAbout(feedId, function (err, about) {
9898 if (err) return cb(err)
9999
100100 pull(
@@ -161,21 +161,8 @@
161161
162162 function serveFeeds(req, res, following, channelSubscriptions, feedId, name) {
163163 var opts = defaultOpts
164164
165- opts.marked = {
166- gfm: true,
167- mentions: true,
168- tables: true,
169- breaks: true,
170- pedantic: false,
171- sanitize: true,
172- smartLists: true,
173- smartypants: false,
174- emoji: renderEmoji,
175- renderer: new MdRenderer(opts)
176- }
177-
178165 pull(
179166 sbot.createLogStream({ reverse: true, limit: 2500 }),
180167 pull.filter((msg) => {
181168 return !msg.value ||
@@ -207,21 +194,8 @@
207194 console.log("serving channel: " + channelId)
208195
209196 var opts = defaultOpts
210197
211- opts.marked = {
212- gfm: true,
213- mentions: true,
214- tables: true,
215- breaks: true,
216- pedantic: false,
217- sanitize: true,
218- smartLists: true,
219- smartypants: false,
220- emoji: renderEmoji,
221- renderer: new MdRenderer(opts)
222- }
223-
224198 pull(
225199 sbot.query.read({ limit: 500, reverse: true, query: [{$filter: { value: { content: { channel: channelId }}}}]}),
226200 pull.collect(function (err, logs) {
227201 if (err) return respond(res, 500, err.stack || err)

Built with git-ssb-web