git ssb

3+

ev / sdash



Commit 5d1e9496d15fbcceddb42ee792bba959568a9e01

use encodeURIComponent so all profile urls render

Ev Bogue committed on 9/4/2016, 11:09:27 PM
Parent: dcf9fdef37a0d789731415d11d08d29e777cf1ed

Files changed

index.jschanged
layouts/index.jadechanged
index.jsView
@@ -5,12 +5,10 @@
55 var markdown = require('marked');
66 var favicon = require('serve-favicon');
77 var moment = require('moment');
88
9-var me = '@EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519';
9 +var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519';
1010
11-var pin = '%6ogHrwUivc2Tn3nq87vepXfPDLMWIiEIu0rqGPl0Kkg=.sha256';
12-
1311 var bloburl = 'http://localhost:8989/blobs/get/';
1412
1513 var app = express();
1614
@@ -43,33 +41,8 @@
4341 })
4442 })
4543 });
4644
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-
7245 app.get('/', function (req, res) {
7346 client(function (err, sbot) {
7447 if (err) {
7548 throw err;
@@ -81,11 +54,17 @@
8154 name = avatar.name;
8255 image = avatar.image;
8356 })
8457 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}),
8659 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 + )
8867 })
8968 )
9069 pull(
9170 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}),
@@ -123,8 +102,5 @@
123102 res.render('index', { title: 'Evbogue.com', markdown, moment, bloburl});
124103 }
125104 });
126105
127-
128106 app.listen('7000');
129-
130-
layouts/index.jadeView
@@ -1,32 +1,35 @@
11 extends layout
22
33 block content
4- p This is <a href='http://gitmx.com/%25qrU04j9vfUJKfq1rGZrQ5ihtSfA4ilfY3wLy7xFv0xk%3D.sha256/'>sdash</a>
54 div.message
65 p.small.ri: strong pinned #{pinned.value.content.type}
76 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>
98 != markdown(pinned.value.content.text)
109 span.date #{moment(pinned.value.timestamp).fromNow()}
10 + if (pinned.value.content.channel)
11 + span in ##{pinned.value.content.channel}
1112 div.message
1213 p.small.ri: strong #{post.value.content.type}
1314 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>
1516 != markdown(post.value.content.text)
1617 span.date #{moment(post.value.timestamp).fromNow()}
1718 div.message
1819 p.small.ri: strong #{vote.value.content.type}
1920 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}
2122 span.date #{moment(vote.value.timestamp).fromNow()}
2223 div.message
2324 p.small.ri: strong #{redo.value.content.type}
2425 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>
2627 != markdown(redo.value.content.text)
2728 span.date #{moment(redo.value.timestamp).fromNow()}
2829 div.message
2930 p.small.ri: strong #{gits.value.content.type}
3031 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 />
3233 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