git ssb

3+

ev / sdash



Commit 939131de1b3dc97dbc7e870137b2b17017486f75

create new sdash composition with only one post

Ev Bogue committed on 9/29/2016, 10:32:36 PM
Parent: 93111b0067bd271cf647b5e5e459f1f75ee6fc54

Files changed

index.jschanged
index.jsView
@@ -9,37 +9,10 @@
99 var ref = require('ssb-ref')
1010
1111 var title = 'sdash'
1212 var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'
13-var desc = 'This is <a href="https://gitmx.com/%25qrU04j9vfUJKfq1rGZrQ5ihtSfA4ilfY3wLy7xFv0xk%3D.sha256">sdash</a>, a work-in-progress personal gateway to the <a href="http://ssbc.github.io">scuttlebot</a> distributed social network.'
1413 var bloburl = 'http://localhost:8989/blobs/get/'
1514
16-var loc = 'The World'
17-var email = 'No email'
18-
19-var pin = 'No pinned message, yet'
20-
21-client(function (err, sbot) {
22- pull(
23- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'email'}}}}], limit: 1, reverse: true}),
24- pull.drain(function (data) {
25- email = data.value.content.email
26- })
27- )
28- pull(
29- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'location'}}}}], limit: 1, reverse: true}),
30- pull.drain(function (data) {
31- loc = data.value.content.location
32- })
33- )
34- pull(
35- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'website'}}}}], limit: 1, reverse: true}),
36- pull.drain(function (data) {
37- website = data.value.content.website
38- })
39- )
40-})
41-
4215 http.createServer(function (req, res){
4316 if (req.url === '/') {
4417 client(function (err, sbot) {
4518 avatar(sbot, me, me, function (err, avatar){
@@ -50,56 +23,11 @@
5023 pull(
5124 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}),
5225 pull.drain(function (data) {
5326 post = data
27 + gotPost()
5428 })
5529 )
56- pull(
57- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'pin'}}}}], limit: 1, reverse: true}),
58- pull.drain(function (data) {
59- getpin = data
60- pull(
61- sbot.query.read({query: [{$filter: { key: getpin.value.content.link}}]}),
62- pull.drain(function (data) {
63- pinned = data
64- })
65- )
66- })
67- )
68- pull(
69- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'vote'}}}}], limit: 1, reverse: true}),
70- pull.drain(function (data) {
71- vote = data
72- pull(
73- sbot.query.read({query: [{$filter: { key: data.value.content.vote.link}}]}),
74- pull.drain(function (data) {
75- avatar(sbot, me, data.value.author, function (err, avatar){
76- if (err) throw err
77- reauthor = avatar
78- gotPost()
79- })
80- redo = data
81- })
82- )
83- })
84- )
85- pull(
86- sbot.query.read({query: [{$filter: { value: { content: {mentions: [{link: me}]}}}}], limit: 1, reverse: true}),
87- pull.drain(function (data) {
88- avatar(sbot, me, data.value.author, function (err, avatar){
89- if (err) throw err
90- mentionauthor = avatar
91- })
92- mention = data
93- })
94- )
95- pull(
96- sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'git-update'}}}}], limit: 1, reverse: true}),
97- pull.drain(function (data) {
98- gits = data
99- })
100- )
101-
10230 })
10331 function gotPost() {
10432 res.end(
10533 h('html',
@@ -107,50 +35,15 @@
10735 h('title', title),
10836 h('style', fs.readFileSync('style.css', 'utf8'))
10937 ),
11038 h('body',
111- h('div.ad',
112- h('p', {innerHTML: '<a href="https://evbogue.com/liteclient.png"><img src="https://evbogue.com/liteclient.png" style="margin-bottom: 1em; width: 100%;"></a>Get a lite client invite.<br />Email <a href="mailto:ev@evbogue.com">ev@evbogue.com</a>'})
113- ),
114- h('img.profile', {src: bloburl + image}),
115- h('h1',
116- h('a', {href: me }, '@' + name)
117- ),
118- h('p', loc + ' | ',
119- h('a', {href: 'mailto:' + email}, email)
120- ),
121- h('p', {innerHTML: '<a href="/node">Minimal Node</a> | <a href="/minimalist">The Art of Being Minimalist</a>'}),
122- h('p', {innerHTML: desc}),
123- h('hr'),
12439 h('div.msg',
125- h('p.small.ri', 'pinned'),
126- h('img.avatar', {src: bloburl + image}),
127- h('a', {href: me }, '@' + name),
128- h('div', {innerHTML: md.block(pinned.value.content.text)},
129- h('span.date', mo(pinned.value.timestamp).fromNow())
130- )
131- ),
132- h('div.msg',
13340 h('p.small.ri', 'post'),
13441 h('img.avatar', {src: bloburl + image}),
13542 h('a', {href: me }, '@' + name),
13643 h('div', {innerHTML: md.block(post.value.content.text)},
13744 h('span.date', mo(post.value.timestamp).fromNow())
13845 )
139- ),
140- h('div.msg',
141- h('p.small.ri', 'dig'),
142- h('img.avatar', {src: bloburl + image}),
143- h('a', {href: me }, '@' + name), ' dug ',
144- h('a', {href: vote.value.content.vote.link}, redo.value.content.text.substring(0, 40)), '...',
145- h('p.date', mo(vote.value.timestamp).fromNow()),
146- h('div.msg',
147- h('img.avatar', {src: bloburl + reauthor.image}),
148- h('a', {href: reauthor.name }, '@' + reauthor.name),
149- h('div', {innerHTML: md.block(redo.value.content.text)},
150- h('span.date', mo(redo.value.timestamp).fromNow())
151- )
152- )
15346 )
15447 )
15548 ).outerHTML)
15649 }

Built with git-ssb-web