Better headers

This commit is contained in:
Anders Rune Jensen
2017-05-11 21:15:38 +02:00
parent bd1f870b33
commit 58e51b9874
+12 -6
View File
@@ -120,6 +120,9 @@ exports.init = function (sbot, config) {
renderer: new MdRenderer(opts) renderer: new MdRenderer(opts)
} }
getAbout(feedId, function (err, about) {
if (err) return cb(err)
pull( pull(
sbot.createUserStream({ id: feedId, reverse: true }), sbot.createUserStream({ id: feedId, reverse: true }),
pull.collect(function (err, logs) { pull.collect(function (err, logs) {
@@ -132,13 +135,14 @@ exports.init = function (sbot, config) {
paramap(addAuthorAbout, 8), paramap(addAuthorAbout, 8),
paramap(addFollowAbout, 8), paramap(addFollowAbout, 8),
paramap(addVoteMessage, 8), paramap(addVoteMessage, 8),
pull(renderThread(opts), wrapPage(feedId)), pull(renderThread(opts), wrapPage(about.name)),
toPull(res, function (err) { toPull(res, function (err) {
if (err) console.error('[viewer]', err) if (err) console.error('[viewer]', err)
}) })
) )
}) })
) )
})
} }
function serveUserFeed(req, res, url) { function serveUserFeed(req, res, url) {
@@ -148,6 +152,7 @@ exports.init = function (sbot, config) {
var following = [] var following = []
var channelSubscriptions = [] var channelSubscriptions = []
getAbout(feedId, function (err, about) {
pull( pull(
sbot.createUserStream({ id: feedId }), sbot.createUserStream({ id: feedId }),
pull.filter((msg) => { pull.filter((msg) => {
@@ -174,12 +179,13 @@ exports.init = function (sbot, config) {
} }
}) })
serveFeeds(req, res, following, channelSubscriptions, feedId) serveFeeds(req, res, following, channelSubscriptions, feedId, 'user feed ' + about.name)
}) })
) )
})
} }
function serveFeeds(req, res, following, channelSubscriptions, feedId) { function serveFeeds(req, res, following, channelSubscriptions, feedId, name) {
var opts = defaultOpts var opts = defaultOpts
opts.marked = { opts.marked = {
@@ -213,7 +219,7 @@ exports.init = function (sbot, config) {
paramap(addAuthorAbout, 8), paramap(addAuthorAbout, 8),
paramap(addFollowAbout, 8), paramap(addFollowAbout, 8),
paramap(addVoteMessage, 8), paramap(addVoteMessage, 8),
pull(renderThread(opts), wrapPage(feedId)), pull(renderThread(opts), wrapPage(name)),
toPull(res, function (err) { toPull(res, function (err) {
if (err) console.error('[viewer]', err) if (err) console.error('[viewer]', err)
}) })
@@ -252,7 +258,7 @@ exports.init = function (sbot, config) {
pull.values(logs), pull.values(logs),
paramap(addAuthorAbout, 8), paramap(addAuthorAbout, 8),
paramap(addVoteMessage, 8), paramap(addVoteMessage, 8),
pull(renderThread(opts), wrapPage(channelId)), pull(renderThread(opts), wrapPage('#' + channelId)),
toPull(res, function (err) { toPull(res, function (err) {
if (err) console.error('[viewer]', err) if (err) console.error('[viewer]', err)
}) })
@@ -481,7 +487,7 @@ function renderThread(opts) {
function wrapPage(id) { function wrapPage(id) {
return wrap('<!doctype html><html><head>' return wrap('<!doctype html><html><head>'
+ '<meta charset=utf-8>' + '<meta charset=utf-8>'
+ '<title>' + id + '</title>' + '<title>' + id + ' | ssb-viewer</title>'
+ '<meta name=viewport content="width=device-width,initial-scale=1">' + '<meta name=viewport content="width=device-width,initial-scale=1">'
+ '<link rel=stylesheet href="/static/base.css">' + '<link rel=stylesheet href="/static/base.css">'
+ '<link rel=stylesheet href="/static/nicer.css">' + '<link rel=stylesheet href="/static/nicer.css">'