Commit 4f7d162bf1625d6dc4e8e518f55ee5d842d12bc2
Refactor
Anders Rune Jensen committed on 5/11/2017, 7:45:07 PMParent: 02bfe74c0273e98741997b1d9d8c28a583dffda2
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -46,8 +46,21 @@ | ||
46 | 46 … | img_base: conf.img_base || base, |
47 | 47 … | emoji_base: conf.emoji_base || (base + 'emoji/'), |
48 | 48 … | } |
49 | 49 … | |
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 … | + | |
50 | 63 … | var getMsg = memo({cache: lru(100)}, getMsgWithValue, sbot) |
51 | 64 … | var getAbout = memo({cache: lru(100)}, require('./lib/about'), sbot) |
52 | 65 … | |
53 | 66 … | http.createServer(serve).listen(port, host, function () { |
@@ -80,21 +93,8 @@ | ||
80 | 93 … | console.log("serving feed: " + feedId) |
81 | 94 … | |
82 | 95 … | var opts = defaultOpts |
83 | 96 … | |
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 | - | |
97 | 97 … | getAbout(feedId, function (err, about) { |
98 | 98 … | if (err) return cb(err) |
99 | 99 … | |
100 | 100 … | pull( |
@@ -161,21 +161,8 @@ | ||
161 | 161 … | |
162 | 162 … | function serveFeeds(req, res, following, channelSubscriptions, feedId, name) { |
163 | 163 … | var opts = defaultOpts |
164 | 164 … | |
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 | - | |
178 | 165 … | pull( |
179 | 166 … | sbot.createLogStream({ reverse: true, limit: 2500 }), |
180 | 167 … | pull.filter((msg) => { |
181 | 168 … | return !msg.value || |
@@ -207,21 +194,8 @@ | ||
207 | 194 … | console.log("serving channel: " + channelId) |
208 | 195 … | |
209 | 196 … | var opts = defaultOpts |
210 | 197 … | |
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 | - | |
224 | 198 … | pull( |
225 | 199 … | sbot.query.read({ limit: 500, reverse: true, query: [{$filter: { value: { content: { channel: channelId }}}}]}), |
226 | 200 … | pull.collect(function (err, logs) { |
227 | 201 … | if (err) return respond(res, 500, err.stack || err) |
Built with git-ssb-web