Commit 809c5f5ccaa65e969f8cba0b0a6c0d687fde9ff5
add three post types
Ev Bogue committed on 8/21/2016, 10:54:24 PMParent: e33c97439f10b79c669ae219531c5b0b5c60ca3d
Files changed
index.jade | changed |
index.js | changed |
package.json | changed |
static/sdash.css | added |
index.jade | ||
---|---|---|
@@ -2,15 +2,27 @@ | ||
2 | 2 … | html |
3 | 3 … | head |
4 | 4 … | title= title |
5 | 5 … | 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') | |
8 | 9 … | body |
9 | 10 … | .contain |
10 | 11 … | .eight.col.off-two |
11 | 12 … | a(href='/'): h1= title |
12 | 13 … | 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()} | |
15 | 27 … | hr |
16 | 28 … | 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.js | ||
---|---|---|
@@ -1,22 +1,24 @@ | ||
1 | 1 … | var client = require('ssb-client'); |
2 | 2 … | var pull = require('pull-stream'); |
3 | 3 … | var avatar = require('ssb-avatar'); |
4 | 4 … | var moment = require('moment'); |
5 … | +var markdown = require('marked'); | |
5 | 6 … | var app = require('koa')(); |
6 | 7 … | var router = require('koa-router')(); |
7 | -var serve = require('koa-static') | |
8 … | +var serve = require('koa-static'); | |
8 | 9 … | var views = require('co-views'); |
9 | 10 … | |
10 | -var me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'; | |
11 … | +const me = '@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519'; | |
12 … | +const site = 'Evbogue.com'; | |
11 | 13 … | |
12 | 14 … | app.use(router.routes()) |
15 … | +app.use(serve(__dirname + '/static')) | |
13 | 16 … | app.use(serve(__dirname + './../books/build')) |
14 | 17 … | app.use(serve(__dirname + './../site/build')) |
15 | 18 … | app.use(serve(__dirname + './../site/static')) |
16 | 19 … | app.use(serve(__dirname + './../boot/')) |
17 | 20 … | |
18 | - | |
19 | 21 … | var render = views(__dirname, { ext: 'jade'}); |
20 | 22 … | |
21 | 23 … | router.get('/', function *(next) { |
22 | 24 … | client(function (err, sbot) { |
@@ -29,35 +31,28 @@ | ||
29 | 31 … | } |
30 | 32 … | name = avatar.name; |
31 | 33 … | image = avatar.image; |
32 | 34 … | }) |
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 … | + ) | |
57 | 53 … | }); |
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}); | |
60 | 55 … | }); |
61 | 56 … | |
62 | 57 … | app.listen('7000') |
63 | 58 … |
package.json | ||
---|---|---|
@@ -7,8 +7,10 @@ | ||
7 | 7 … | "co-views": "^2.1.0", |
8 | 8 … | "jade": "^1.11.0", |
9 | 9 … | "koa": "^1.2.1", |
10 | 10 … | "koa-router": "^5.4.0", |
11 … | + "koa-static": "^2.0.0", | |
12 … | + "marked": "^0.3.6", | |
11 | 13 … | "moment": "^2.14.1", |
12 | 14 … | "pull-paramap": "^1.1.6", |
13 | 15 … | "pull-stream": "^3.4.3", |
14 | 16 … | "ssb-avatar": "^0.1.0", |
Built with git-ssb-web