git ssb

9+

cel / ssb-viewer



Commit 445c5735109436be4d2b29ffafa9437cd6c2475f

Merge commit 'c1b5c8d'

For About data, use most popular (d87029da1cdaa2cd2211d1e5ef45962db26afcb9)
instead of self-picked (dffd43f062a271d3a9be609e1129bf5ad153a4ff)
cel committed on 5/15/2017, 1:57:27 AM
Parent: d87029da1cdaa2cd2211d1e5ef45962db26afcb9
Parent: c1b5c8d3560b86c156450c93e8be1a9fe4205a20

Files changed

index.jschanged
lib/about.jschanged
render.jschanged
index.jsView
@@ -14,9 +14,10 @@
1414 MdRenderer,
1515 renderEmoji,
1616 formatMsgs,
1717 wrapPage,
18- renderThread
18 + renderThread,
19 + renderAbout
1920 } = require('./render');
2021
2122 var appHash = hash([fs.readFileSync(__filename)])
2223
@@ -107,9 +108,9 @@
107108 paramap(addAuthorAbout, 8),
108109 paramap(addFollowAbout, 8),
109110 paramap(addVoteMessage, 8),
110111 paramap(addGitLinks, 8),
111- pull(renderThread(defaultOpts), wrapPage(about.name)),
112 + pull(renderAbout(defaultOpts, about), wrapPage(about.name)),
112113 toPull(res, function (err) {
113114 if (err) console.error('[viewer]', err)
114115 })
115116 )
@@ -176,8 +177,9 @@
176177 pull.values(logs),
177178 paramap(addAuthorAbout, 8),
178179 paramap(addFollowAbout, 8),
179180 paramap(addVoteMessage, 8),
181 + paramap(addGitLinks, 8),
180182 pull(renderThread(defaultOpts), wrapPage(name)),
181183 toPull(res, function (err) {
182184 if (err) console.error('[viewer]', err)
183185 })
lib/about.jsView
@@ -13,8 +13,9 @@
1313 var aboutByFeed = {}
1414 pull(
1515 sbot.links({
1616 rel: 'about',
17 + source: id,
1718 dest: id,
1819 values: true,
1920 }),
2021 pull.drain(function (msg) {
@@ -23,8 +24,9 @@
2324 if (!c) return
2425 var feedAbout = aboutByFeed[author] || (aboutByFeed[author] = {})
2526 if (c.name) feedAbout.name = c.name.replace(/^@?/, '@')
2627 if (c.image) feedAbout.image = linkDest(c.image)
28 + if (c.description) feedAbout.description = c.description
2729 }, function (err) {
2830 if (err) return cb(err)
2931 // Use whatever properties have the most counts.
3032 // Usually we would want to handle renames for dead feeds and such,
render.jsView
@@ -11,8 +11,9 @@
1111 exports.MdRenderer = MdRenderer;
1212 exports.renderEmoji = renderEmoji;
1313 exports.formatMsgs = formatMsgs;
1414 exports.renderThread = renderThread;
15 +exports.renderAbout = renderAbout;
1516
1617 function MdRenderer(opts) {
1718 marked.Renderer.call(this, {});
1819 this.opts = opts;
@@ -93,8 +94,32 @@
9394 return cat([pull.once(before), read, pull.once(after)]);
9495 };
9596 }
9697
98 +function renderAbout(opts, about) {
99 + return pull(
100 + pull.map(renderMsg.bind(this, opts)),
101 + wrap(
102 + '<span class="top-tip">You are reading content from ' +
103 + '<a href="https://www.scuttlebutt.nz">Scuttlebutt</a>' +
104 + '</span>' +
105 + '<main>' +
106 + '<article><header><figure>' +
107 + '<img src="' + opts.img_base + escape(about.image) + '" ' +
108 + 'height="200" width="200"><figcaption>' +
109 + 'Feed of ' + about.name + '<br/>' +
110 + (about.description != undefined ?
111 + marked(about.description, opts.marked) : '') +
112 + '</figcaption></figure></header></article>',
113 +
114 + '</main>' +
115 + '<a class="call-to-action" href="https://www.scuttlebutt.nz">' +
116 + 'Join Scuttlebutt now' +
117 + '</a>'
118 + )
119 + );
120 +}
121 +
97122 function renderThread(opts) {
98123 return pull(
99124 pull.map(renderMsg.bind(this, opts)),
100125 wrap(
@@ -390,9 +415,8 @@
390415 else if (c.type == "issue") {
391416 return '<span class="status">' +
392417 "Created a git issue" + (c.repoName != undefined ? " in repo " + c.repoName : "") + renderPost(opts, c) +
393418 '</span>';
394- //renderDefault(c);
395419 }
396420 else if (c.type == "git-update") {
397421 return '<span class="status">' +
398422 "Did a git update " + (c.repoName != undefined ? " in repo " + c.repoName : "") +
@@ -407,11 +431,10 @@
407431 renderDefault(c);
408432 }
409433 else if (c.type == "pub") {
410434 return '<span class="status">' +
411- "Connected to a pub" +
412- '</span>' +
413- renderDefault(c);
435 + "Connected to the pub " + c.address.host +
436 + '</span>'
414437 }
415438 else if (c.type == "channel" && c.subscribed)
416439 return '<span class="status">' +
417440 'Subscribed to channel <a href="' + base + 'channel/' +

Built with git-ssb-web