git ssb

3+

ev / sdash



Commit 809c5f5ccaa65e969f8cba0b0a6c0d687fde9ff5

add three post types

Ev Bogue committed on 8/21/2016, 10:54:24 PM
Parent: e33c97439f10b79c669ae219531c5b0b5c60ca3d

Files changed

index.jadechanged
index.jschanged
package.jsonchanged
static/sdash.cssadded
index.jadeView
@@ -2,15 +2,27 @@
22 html
33 head
44 title= title
55 meta(charset='utf8')
6- link(rel='stylesheet' href='/reserva/reserva.css')
7- link(rel='stylesheet' href='/style.css')
6 + link(rel='stylesheet' href='https://evbogue.com/reserva/reserva.css')
7 + link(rel='stylesheet' href='https://evbogue.com/style.css')
8 + link(rel='stylesheet' href='/sdash.css')
89 body
910 .contain
1011 .eight.col.off-two
1112 a(href='/'): h1= title
1213 hr
13- img(src='/ws/blobs/get/#{image}' class='profile' style='float: left; margin-right: .5ex; width: 75px;')
14- p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> #{message} <br /><span style='font-size: .8em;'>#{date} on Sbot</span>
14 + div(class='message')
15 + img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar')
16 + p <a href='http://evbogue.com/' target='_parent'>@#{name}</a>
17 + != markdown(post.value.content.text)
18 + span(style='font-size: .8em;') #{moment(post.value.timestamp).fromNow()}
19 + div(class='message')
20 + img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar')
21 + p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> dug #{vote.value.content.vote.link}<br />
22 + span(style='font-size: .8em;') #{moment(vote.value.timestamp).fromNow()}
23 + div(class='message')
24 + img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar')
25 + p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> pushed a git commit to #{gits.value.content.repo}<br />
26 + span(style='font-size: .8em;') #{moment(gits.value.timestamp).fromNow()}
1527 hr
1628 p(style='font-size: .8em') <a href='mailto:ev@evbogue.com'>ev@evbogue.com</a> | <a href='/minimalist'>The Art of Being Minimalist</a> | <a href='/node'>Minimal Node</a> | <a href='https://gitmx.com/%408Qee0I%2FDwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc%3D.ed25519'>GitMX</a> | Mexico City
index.jsView
@@ -1,22 +1,24 @@
11 var client = require('ssb-client');
22 var pull = require('pull-stream');
33 var avatar = require('ssb-avatar');
44 var moment = require('moment');
5 +var markdown = require('marked');
56 var app = require('koa')();
67 var router = require('koa-router')();
7-var serve = require('koa-static')
8 +var serve = require('koa-static');
89 var views = require('co-views');
910
10-var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519';
11 +const me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519';
12 +const site = 'Evbogue.com';
1113
1214 app.use(router.routes())
15 +app.use(serve(__dirname + '/static'))
1316 app.use(serve(__dirname + './../books/build'))
1417 app.use(serve(__dirname + './../site/build'))
1518 app.use(serve(__dirname + './../site/static'))
1619 app.use(serve(__dirname + './../boot/'))
1720
18-
1921 var render = views(__dirname, { ext: 'jade'});
2022
2123 router.get('/', function *(next) {
2224 client(function (err, sbot) {
@@ -29,35 +31,28 @@
2931 }
3032 name = avatar.name;
3133 image = avatar.image;
3234 })
33- pull(sbot.createUserStream({
34- id: me,
35- limit: 1,
36- reverse: true
37- }),
38- pull.drain(function (msg) {
39- date = moment(msg.value.timestamp).fromNow()
40- if (msg.value.content.type === 'post') {
41- message = (msg.value.content.text)
42- }
43- else if (msg.value.content.type === 'vote') {
44- message = (' dug ' + msg.value.content.vote.link)
45- }
46- else if (msg.value.content.type === 'about') {
47- message = (' identified ' + msg.value.content.about + ' as ' + msg.value.content.name)
48- }
49- else if (msg.value.content.type === 'git-update') {
50- message = (' pushed a git commit ')
51- }
52- else {
53- message = (' sent a private message ')
54- }
55- gotMessage();
56- }));
35 + pull(
36 + sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'post'}}}}], limit: 1, reverse: true}),
37 + pull.drain(function (data) {
38 + post = data;
39 + })
40 + )
41 + pull(
42 + sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'vote'}}}}], limit: 1, reverse: true}),
43 + pull.drain(function (data) {
44 + vote = data;
45 + })
46 + )
47 + pull(
48 + sbot.query.read({query: [{$filter: { value: { author: me, content: {type: 'git-update'}}}}], limit: 1, reverse: true}),
49 + pull.drain(function (data) {
50 + gits = data;
51 + })
52 + )
5753 });
58- function gotMessage() {}
59- this.body = yield render('index', {title: 'Evbogue.com', message, date, name, image});
54 + this.body = yield render('index', {title: site, moment, markdown});
6055 });
6156
6257 app.listen('7000')
6358
package.jsonView
@@ -7,8 +7,10 @@
77 "co-views": "^2.1.0",
88 "jade": "^1.11.0",
99 "koa": "^1.2.1",
1010 "koa-router": "^5.4.0",
11 + "koa-static": "^2.0.0",
12 + "marked": "^0.3.6",
1113 "moment": "^2.14.1",
1214 "pull-paramap": "^1.1.6",
1315 "pull-stream": "^3.4.3",
1416 "ssb-avatar": "^0.1.0",
static/sdash.cssView
@@ -1,0 +1,14 @@
1 +.avatar {
2 + width: 2em;
3 + float: left;
4 + margin-right: 1em;
5 +}
6 +
7 +.message {
8 + border: 1px solid #ccc;
9 + padding: 1em;
10 +}
11 +
12 +.pre {
13 + margin-bottom: 0;
14 +}

Built with git-ssb-web