Commit e0a6ca5dfb54b357d64d5b3e6aa2ca7a4dcc61b3
initial stab at profile routes
Ev Bogue committed on 9/2/2016, 5:02:01 AMParent: 140e6aca32fc537679f079304e695b6c8270dede
Files changed
.gitignore | changed |
index.js | changed |
layouts/index.jade | changed |
layouts/layout.jade | added |
layouts/profile.jade | added |
static/sdash.css | changed |
static/favicon.ico | added |
ipm | added |
index.js | ||
---|---|---|
@@ -2,19 +2,58 @@ | ||
2 | 2 … | var pull = require('pull-stream'); |
3 | 3 … | var client = require('ssb-client'); |
4 | 4 … | var avatar = require('ssb-avatar'); |
5 | 5 … | var markdown = require('marked'); |
6 … | +var favicon = require('serve-favicon'); | |
6 | 7 … | var moment = require('moment'); |
7 | 8 … | |
8 | 9 … | var me = '@EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519'; |
9 | 10 … | |
10 | 11 … | var pin = '%6ogHrwUivc2Tn3nq87vepXfPDLMWIiEIu0rqGPl0Kkg=.sha256'; |
11 | 12 … | |
13 … | +var bloburl = 'http://localhost:8989/blobs/get/'; | |
14 … | + | |
12 | 15 … | var app = express(); |
13 | 16 … | |
14 | 17 … | app.set('views', './layouts') |
15 | 18 … | app.set('view engine', 'jade'); |
16 | 19 … | |
20 … | +app.use(express.static('static')); | |
21 … | +app.use(favicon(__dirname + '/static/favicon.ico')); | |
22 … | + | |
23 … | +app.get('/:key', function (req, res) { | |
24 … | + console.log(req.params); | |
25 … | + client(function (err, sbot) { | |
26 … | + if (err) { | |
27 … | + throw err; | |
28 … | + } | |
29 … | + avatar(sbot, me, req.params.key, function (err, avatar){ | |
30 … | + if (err) { | |
31 … | + throw err; | |
32 … | + } | |
33 … | + key = req.params.key; | |
34 … | + res.render('profile', {avatar, bloburl, key}); | |
35 … | + }) | |
36 … | + }) | |
37 … | +}); | |
38 … | + | |
39 … | + | |
40 … | +app.get('/:key([^/]+/[^/]+)', function (req, res) { | |
41 … | + console.log(req.params); | |
42 … | + client(function (err, sbot) { | |
43 … | + if (err) { | |
44 … | + throw err; | |
45 … | + } | |
46 … | + avatar(sbot, me, req.params.key, function (err, avatar){ | |
47 … | + if (err) { | |
48 … | + throw err; | |
49 … | + } | |
50 … | + key = req.params.key; | |
51 … | + res.render('profile', {avatar, bloburl, key}); | |
52 … | + }) | |
53 … | + }) | |
54 … | +}); | |
55 … | + | |
17 | 56 … | app.get('/', function (req, res) { |
18 | 57 … | client(function (err, sbot) { |
19 | 58 … | if (err) { |
20 | 59 … | throw err; |
@@ -64,13 +103,12 @@ | ||
64 | 103 … | }) |
65 | 104 … | ) |
66 | 105 … | }); |
67 | 106 … | function gotPost() { |
68 | - res.render('index', { title: 'Evbogue.com', markdown, moment}); | |
107 … | + res.render('index', { title: 'Evbogue.com', markdown, moment, bloburl}); | |
69 | 108 … | } |
70 | 109 … | }); |
71 | 110 … | |
72 | -app.use(express.static('static')); | |
73 | 111 … | |
74 | 112 … | app.listen('7000'); |
75 | 113 … | |
76 | 114 … |
layouts/index.jade | ||
---|---|---|
@@ -1,36 +1,32 @@ | ||
1 | -doctype html | |
2 | -html | |
3 | - head | |
4 | - title= title | |
5 | - meta(charset='utf8') | |
6 | - link(rel='stylesheet' href='/sdash.css') | |
7 | - body | |
8 | - p This is <a href='http://gitmx.com/%25qrU04j9vfUJKfq1rGZrQ5ihtSfA4ilfY3wLy7xFv0xk%3D.sha256/'>sdash</a> | |
9 | - div.message | |
10 | - p.small.ri: strong pinned #{pinned.value.content.type} | |
11 | - img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar') | |
12 | - p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> | |
13 | - != markdown(pinned.value.content.text) | |
14 | - span.date #{moment(pinned.value.timestamp).fromNow()} | |
15 | - div.message | |
16 | - p.small.ri: strong #{post.value.content.type} | |
17 | - img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar') | |
18 | - p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> | |
19 | - != markdown(post.value.content.text) | |
20 | - span.date #{moment(post.value.timestamp).fromNow()} | |
21 | - div.message | |
22 | - p.small.ri: strong #{vote.value.content.type} | |
23 | - img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar') | |
24 | - p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> dug #{vote.value.content.vote.link} | |
25 | - span.date #{moment(vote.value.timestamp).fromNow()} | |
26 | - div.message | |
27 | - p.small.ri: strong #{redo.value.content.type} | |
28 | - img(src='https://evbogue.com/ws/blobs/get/#{reauthor.image}' class='avatar') | |
29 | - p @<a href='#{redo.value.author}'>#{reauthor.name}</a> | |
30 | - != markdown(redo.value.content.text) | |
31 | - span.date #{moment(redo.value.timestamp).fromNow()} | |
32 | - div.message | |
33 | - p.small.ri: strong #{gits.value.content.type} | |
34 | - img(src='https://evbogue.com/ws/blobs/get/#{image}' class='avatar') | |
35 | - p <a href='http://evbogue.com/' target='_parent'>@#{name}</a> pushed a git commit to #{gits.value.content.repo}<br /> | |
36 | - span.date #{moment(gits.value.timestamp).fromNow()} | |
1 … | +extends layout | |
2 … | + | |
3 … | +block content | |
4 … | + p This is <a href='http://gitmx.com/%25qrU04j9vfUJKfq1rGZrQ5ihtSfA4ilfY3wLy7xFv0xk%3D.sha256/'>sdash</a> | |
5 … | + div.message | |
6 … | + p.small.ri: strong pinned #{pinned.value.content.type} | |
7 … | + img(src='#{bloburl}#{image}' class='avatar') | |
8 … | + p <a href='#{pinned.value.author}' target='_parent'>@#{name}</a> | |
9 … | + != markdown(pinned.value.content.text) | |
10 … | + span.date #{moment(pinned.value.timestamp).fromNow()} | |
11 … | + div.message | |
12 … | + p.small.ri: strong #{post.value.content.type} | |
13 … | + img(src='#{bloburl}#{image}' class='avatar') | |
14 … | + p <a href='#{post.value.key}' target='_parent'>@#{name}</a> | |
15 … | + != markdown(post.value.content.text) | |
16 … | + span.date #{moment(post.value.timestamp).fromNow()} | |
17 … | + div.message | |
18 … | + p.small.ri: strong #{vote.value.content.type} | |
19 … | + img(src='#{bloburl}#{image}' class='avatar') | |
20 … | + p <a href='#{vote.value.author}' target='_parent'>@#{name}</a> dug #{vote.value.content.vote.link} | |
21 … | + span.date #{moment(vote.value.timestamp).fromNow()} | |
22 … | + div.message | |
23 … | + p.small.ri: strong #{redo.value.content.type} | |
24 … | + img(src='#{bloburl}#{reauthor.image}' class='avatar') | |
25 … | + p @<a href='#{redo.value.author}'>#{reauthor.name}</a> | |
26 … | + != markdown(redo.value.content.text) | |
27 … | + span.date #{moment(redo.value.timestamp).fromNow()} | |
28 … | + div.message | |
29 … | + p.small.ri: strong #{gits.value.content.type} | |
30 … | + img(src='#{bloburl}#{image}' class='avatar') | |
31 … | + p <a href='#{gits.value.author}' target='_parent'>@#{name}</a> pushed a git commit to #{gits.value.content.repo}<br /> | |
32 … | + span.date #{moment(gits.value.timestamp).fromNow()} |
layouts/layout.jade | ||
---|---|---|
@@ -1,0 +1,12 @@ | ||
1 … | +doctype html | |
2 … | +html | |
3 … | + head | |
4 … | + title= title | |
5 … | + meta(charset='utf8') | |
6 … | + link(rel='stylesheet' href='/reserva/reserva.css') | |
7 … | + link(rel='stylesheet' href='/ssp/ssp.css') | |
8 … | + link(rel='stylesheet' href='/sdash.css') | |
9 … | + body | |
10 … | + .contain | |
11 … | + .eight.col.off-two | |
12 … | + block content |
layouts/profile.jade | ||
---|---|---|
@@ -1,0 +1,6 @@ | ||
1 … | +extends layout | |
2 … | + | |
3 … | +block content | |
4 … | + div.message | |
5 … | + a(href='/#{key}'): img(src='http://localhost:8989/blobs/get/#{avatar.image}' style='width: 5em; float: left; margin-right: 1em;' class='profile') | |
6 … | + p <strong>Name:</strong> <a href='/#{key}'>@#{avatar.name}</a><br /><strong>Pubkey:</strong> #{key} |
static/sdash.css | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 … | p { |
2 | - font-family: sans-serif; | |
2 … | + font-family: 'Source Sans Pro', sans-serif; | |
3 | 3 … | } |
4 | 4 … | |
5 | 5 … | .avatar { |
6 | 6 … | width: 2em; |
static/favicon.ico |
---|
Built with git-ssb-web