git ssb

3+

ev / sdash



Tree: 68800fb402b2c3c75ba347d8e573be85045bdd13

Files: 68800fb402b2c3c75ba347d8e573be85045bdd13 / index.js

1951 bytesRaw
1var express = require('express');
2var pull = require('pull-stream');
3var client = require('ssb-client');
4var avatar = require('ssb-avatar');
5var markdown = require('marked');
6var moment = require('moment');
7
8var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519';
9
10var app = express();
11
12app.set('view engine', 'jade');
13
14
15
16app.get('/', function (req, res) {
17 client(function (err, sbot) {
18 if (err) {
19 throw err;
20 }
21 avatar(sbot, me, me, function (err, avatar){
22 if (err) {
23 throw err;
24 }
25 name = avatar.name;
26 image = avatar.image;
27 })
28 pull(
29 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}),
30 pull.drain(function (data) {
31 post = data;
32 })
33 )
34 pull(
35 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'vote'}}}}], limit: 1, reverse: true}),
36 pull.drain(function (data) {
37 vote = data;
38 pull(
39 sbot.query.read({query: [{$filter: { key: data.value.content.vote.link}}]}),
40 pull.drain(function (reblog) {
41 avatar(sbot, me, reblog.value.author, function (err, avatar){
42 if (err) {
43 throw err;
44 }
45 reauthor = avatar;
46 gotPost();
47 })
48 redo = reblog;
49 })
50 )
51 })
52 )
53 pull(
54 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'git-update'}}}}], limit: 1, reverse: true}),
55 pull.drain(function (data) {
56 gits = data;
57 })
58 )
59 });
60 function gotPost() {
61 res.render('index', { title: 'Evbogue.com', markdown, moment});
62 }
63});
64
65app.use(express.static('static'));
66app.use(express.static('./../books/build'));
67app.use(express.static('./../site/build'));
68app.use(express.static('./../site/static'));
69app.use(express.static('./../boot'));
70
71app.listen('7000');
72
73
74

Built with git-ssb-web