Commit 939131de1b3dc97dbc7e870137b2b17017486f75
create new sdash composition with only one post
Ev Bogue committed on 9/29/2016, 10:32:36 PMParent: 93111b0067bd271cf647b5e5e459f1f75ee6fc54
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -9,37 +9,10 @@ | |||
9 | 9 … | var ref = require('ssb-ref') | |
10 | 10 … | ||
11 | 11 … | var title = 'sdash' | |
12 | 12 … | 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.' | ||
14 | 13 … | var bloburl = 'http://localhost:8989/blobs/get/' | |
15 | 14 … | ||
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 | - | ||
42 | 15 … | http.createServer(function (req, res){ | |
43 | 16 … | if (req.url === '/') { | |
44 | 17 … | client(function (err, sbot) { | |
45 | 18 … | avatar(sbot, me, me, function (err, avatar){ | |
@@ -50,56 +23,11 @@ | |||
50 | 23 … | pull( | |
51 | 24 … | sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}), | |
52 | 25 … | pull.drain(function (data) { | |
53 | 26 … | post = data | |
27 … | + gotPost() | ||
54 | 28 … | }) | |
55 | 29 … | ) | |
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 | - | ||
102 | 30 … | }) | |
103 | 31 … | function gotPost() { | |
104 | 32 … | res.end( | |
105 | 33 … | h('html', | |
@@ -107,50 +35,15 @@ | |||
107 | 35 … | h('title', title), | |
108 | 36 … | h('style', fs.readFileSync('style.css', 'utf8')) | |
109 | 37 … | ), | |
110 | 38 … | 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'), | ||
124 | 39 … | 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', | ||
133 | 40 … | h('p.small.ri', 'post'), | |
134 | 41 … | h('img.avatar', {src: bloburl + image}), | |
135 | 42 … | h('a', {href: me }, '@' + name), | |
136 | 43 … | h('div', {innerHTML: md.block(post.value.content.text)}, | |
137 | 44 … | h('span.date', mo(post.value.timestamp).fromNow()) | |
138 | 45 … | ) | |
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 | - ) | ||
153 | 46 … | ) | |
154 | 47 … | ) | |
155 | 48 … | ).outerHTML) | |
156 | 49 … | } |
Built with git-ssb-web