index.jsView |
---|
20 | 20 | app.use(express.static('static')); |
21 | 21 | app.use(favicon(__dirname + '/static/favicon.ico')); |
22 | 22 | |
23 | 23 | app.get('/:key', function (req, res) { |
24 | | - console.log(req.params); |
25 | 24 | client(function (err, sbot) { |
26 | 25 | if (err) { |
27 | 26 | throw err; |
28 | 27 | } |
31 | 30 | throw err; |
32 | 31 | } |
33 | 32 | key = req.params.key; |
34 | 33 | pull( |
35 | | - sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}), |
| 34 | + sbot.query.read({query: [{$filter: { value: { author: key, content: {type: 'post'}}}}], limit: 1, reverse: true}), |
36 | 35 | pull.drain(function (data) { |
37 | 36 | post = data; |
38 | | - console.log(data) |
39 | | - }) |
40 | | - ) |
41 | | - res.render('profile', {avatar, bloburl, key}); |
| 37 | + }) |
| 38 | + ) |
| 39 | + res.render('profile', {avatar, bloburl, key, markdown, moment}); |
42 | 40 | }) |
43 | 41 | }) |
44 | 42 | }); |
45 | 43 | |
46 | 44 | |
47 | 45 | app.get('/:key([^/]+/[^/]+)', function (req, res) { |
48 | | - console.log(req.params); |
49 | 46 | client(function (err, sbot) { |
50 | 47 | if (err) { |
51 | 48 | throw err; |
52 | 49 | } |
54 | 51 | if (err) { |
55 | 52 | throw err; |
56 | 53 | } |
57 | 54 | key = req.params.key; |
58 | | - res.render('profile', {avatar, bloburl, key}); |
| 55 | + pull( |
| 56 | + sbot.query.read({query: [{$filter: { value: { author: key, content: {type: 'post'}}}}], limit: 1, reverse: true}), |
| 57 | + pull.drain(function (data) { |
| 58 | + post = data; |
| 59 | + }) |
| 60 | + ) |
| 61 | + res.render('profile', {avatar, bloburl, key, markdown, moment}); |
59 | 62 | }) |
60 | 63 | }) |
61 | 64 | }); |
62 | 65 | |