git ssb

3+

ev / sdash



Tree: 7430f885d9d92edaa6642db61b753dde7fc9bc13

Files: 7430f885d9d92edaa6642db61b753dde7fc9bc13 / index.js

2226 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 pin = '%yP7vCxyJOKXTHYIKZ+vANjfU2dDNwyJsYYJKAJTZO2Y=.sha256';
11
12var app = express();
13
14app.set('view engine', 'jade');
15
16
17
18app.get('/', function (req, res) {
19 client(function (err, sbot) {
20 if (err) {
21 throw err;
22 }
23 avatar(sbot, me, me, function (err, avatar){
24 if (err) {
25 throw err;
26 }
27 name = avatar.name;
28 image = avatar.image;
29 })
30 pull(
31 sbot.query.read({query: [{$filter: { key: pin}}], limit: 1, reverse: true}),
32 pull.drain(function (data) {
33 pinned = data;
34 })
35 )
36 pull(
37 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}),
38 pull.drain(function (data) {
39 post = data;
40 })
41 )
42 pull(
43 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'vote'}}}}], limit: 1, reverse: true}),
44 pull.drain(function (data) {
45 vote = data;
46 pull(
47 sbot.query.read({query: [{$filter: { key: data.value.content.vote.link}}]}),
48 pull.drain(function (reblog) {
49 avatar(sbot, me, reblog.value.author, function (err, avatar){
50 if (err) {
51 throw err;
52 }
53 reauthor = avatar;
54 gotPost();
55 })
56 redo = reblog;
57 })
58 )
59 })
60 )
61 pull(
62 sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'git-update'}}}}], limit: 1, reverse: true}),
63 pull.drain(function (data) {
64 gits = data;
65 })
66 )
67 });
68 function gotPost() {
69 res.render('index', { title: 'Evbogue.com', markdown, moment});
70 }
71});
72
73app.use(express.static('static'));
74app.use(express.static('./../books/build'));
75app.use(express.static('./../site/build'));
76app.use(express.static('./../site/static'));
77app.use(express.static('./../farsmith'));
78app.use(express.static('./../boot'));
79
80app.listen('7000');
81
82
83

Built with git-ssb-web