Commit 5d1e9496d15fbcceddb42ee792bba959568a9e01
use encodeURIComponent so all profile urls render
Ev Bogue committed on 9/4/2016, 11:09:27 PMParent: dcf9fdef37a0d789731415d11d08d29e777cf1ed
Files changed
index.js | changed |
layouts/index.jade | changed |
index.js | |||
---|---|---|---|
@@ -5,12 +5,10 @@ | |||
5 | 5 … | var markdown = require('marked'); | |
6 | 6 … | var favicon = require('serve-favicon'); | |
7 | 7 … | var moment = require('moment'); | |
8 | 8 … | ||
9 | -var me = '@EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519'; | ||
9 … | +var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'; | ||
10 | 10 … | ||
11 | -var pin = '%6ogHrwUivc2Tn3nq87vepXfPDLMWIiEIu0rqGPl0Kkg=.sha256'; | ||
12 | - | ||
13 | 11 … | var bloburl = 'http://localhost:8989/blobs/get/'; | |
14 | 12 … | ||
15 | 13 … | var app = express(); | |
16 | 14 … | ||
@@ -43,33 +41,8 @@ | |||
43 | 41 … | }) | |
44 | 42 … | }) | |
45 | 43 … | }); | |
46 | 44 … | ||
47 | - | ||
48 | -app.get('/:key([^/]+/[^/]+)', function (req, res) { | ||
49 | - client(function (err, sbot) { | ||
50 | - if (err) { | ||
51 | - throw err; | ||
52 | - } | ||
53 | - avatar(sbot, me, req.params.key, function (err, avatar){ | ||
54 | - if (err) { | ||
55 | - throw err; | ||
56 | - } | ||
57 | - key = req.params.key; | ||
58 | - pull( | ||
59 | - sbot.query.read({query: [{$filter: { value: { author: key, content: {type: 'post'}}}}], limit: 1, reverse: true}), | ||
60 | - pull.drain(function (data) { | ||
61 | - post = data; | ||
62 | - gotPost() | ||
63 | - }) | ||
64 | - ) | ||
65 | - function gotPost() { | ||
66 | - res.render('profile', {avatar, bloburl, key, markdown, moment}); | ||
67 | - } | ||
68 | - }) | ||
69 | - }) | ||
70 | -}); | ||
71 | - | ||
72 | 45 … | app.get('/', function (req, res) { | |
73 | 46 … | client(function (err, sbot) { | |
74 | 47 … | if (err) { | |
75 | 48 … | throw err; | |
@@ -81,11 +54,17 @@ | |||
81 | 54 … | name = avatar.name; | |
82 | 55 … | image = avatar.image; | |
83 | 56 … | }) | |
84 | 57 … | pull( | |
85 | - sbot.query.read({query: [{$filter: { key: pin}}], limit: 1, reverse: true}), | ||
58 … | + sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'pin'}}}}], limit: 1, reverse: true}), | ||
86 | 59 … | pull.drain(function (data) { | |
87 | - pinned = data; | ||
60 … | + getpin = data; | ||
61 … | + pull( | ||
62 … | + sbot.query.read({query: [{$filter: { key: getpin.value.content.link}}]}), | ||
63 … | + pull.drain(function (data) { | ||
64 … | + pinned = data; | ||
65 … | + }) | ||
66 … | + ) | ||
88 | 67 … | }) | |
89 | 68 … | ) | |
90 | 69 … | pull( | |
91 | 70 … | sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}), | |
@@ -123,8 +102,5 @@ | |||
123 | 102 … | res.render('index', { title: 'Evbogue.com', markdown, moment, bloburl}); | |
124 | 103 … | } | |
125 | 104 … | }); | |
126 | 105 … | ||
127 | - | ||
128 | 106 … | app.listen('7000'); | |
129 | - | ||
130 | - |
layouts/index.jade | ||
---|---|---|
@@ -1,32 +1,35 @@ | ||
1 | 1 … | extends layout |
2 | 2 … | |
3 | 3 … | block content |
4 | - p This is <a href='http://gitmx.com/%25qrU04j9vfUJKfq1rGZrQ5ihtSfA4ilfY3wLy7xFv0xk%3D.sha256/'>sdash</a> | |
5 | 4 … | div.message |
6 | 5 … | p.small.ri: strong pinned #{pinned.value.content.type} |
7 | 6 … | img(src='#{bloburl}#{image}' class='avatar') |
8 | - p <a href='#{pinned.value.author}' target='_parent'>@#{name}</a> | |
7 … | + p <a href='#{encodeURIComponent(pinned.value.author)}' target='_parent'>@#{name}</a> | |
9 | 8 … | != markdown(pinned.value.content.text) |
10 | 9 … | span.date #{moment(pinned.value.timestamp).fromNow()} |
10 … | + if (pinned.value.content.channel) | |
11 … | + span in ##{pinned.value.content.channel} | |
11 | 12 … | div.message |
12 | 13 … | p.small.ri: strong #{post.value.content.type} |
13 | 14 … | img(src='#{bloburl}#{image}' class='avatar') |
14 | - p <a href='#{post.value.key}' target='_parent'>@#{name}</a> | |
15 … | + p <a href='#{encodeURIComponent(post.value.author)}' target='_parent'>@#{name}</a> | |
15 | 16 … | != markdown(post.value.content.text) |
16 | 17 … | span.date #{moment(post.value.timestamp).fromNow()} |
17 | 18 … | div.message |
18 | 19 … | p.small.ri: strong #{vote.value.content.type} |
19 | 20 … | img(src='#{bloburl}#{image}' class='avatar') |
20 | - p <a href='#{vote.value.author}' target='_parent'>@#{name}</a> dug #{vote.value.content.vote.link} | |
21 … | + p <a href='#{encodeURIComponent(vote.value.author)}' target='_parent'>@#{name}</a> dug #{vote.value.content.vote.link} | |
21 | 22 … | span.date #{moment(vote.value.timestamp).fromNow()} |
22 | 23 … | div.message |
23 | 24 … | p.small.ri: strong #{redo.value.content.type} |
24 | 25 … | img(src='#{bloburl}#{reauthor.image}' class='avatar') |
25 | - p @<a href='#{redo.value.author}'>#{reauthor.name}</a> | |
26 … | + p @<a href='#{encodeURIComponent(redo.value.author)}'>#{reauthor.name}</a> | |
26 | 27 … | != markdown(redo.value.content.text) |
27 | 28 … | span.date #{moment(redo.value.timestamp).fromNow()} |
28 | 29 … | div.message |
29 | 30 … | p.small.ri: strong #{gits.value.content.type} |
30 | 31 … | img(src='#{bloburl}#{image}' class='avatar') |
31 | - p <a href='#{gits.value.author}' target='_parent'>@#{name}</a> pushed a git commit to #{gits.value.content.repo}<br /> | |
32 … | + p <a href='#{encodeURIComponent(gits.value.author)}' target='_parent'>@#{name}</a> pushed a git commit to #{gits.value.content.repo}<br /> | |
32 | 33 … | span.date #{moment(gits.value.timestamp).fromNow()} |
34 … | + hr | |
35 … | + p This is <a href='http://gitmx.com/%25qrU04j9vfUJKfq1rGZrQ5ihtSfA4ilfY3wLy7xFv0xk%3D.sha256/'>sdash</a> |
Built with git-ssb-web