git ssb

9+

cel / ssb-viewer



Commit 7123fbcab15c43bbb962d1312a465fddf164493c

Default to require opt-in for publicWebHosting

cel committed on 8/17/2018, 10:32:42 PM
Parent: ba6d7cd3abf79e5283853b32cbebf218dae8c981

Files changed

README.mdchanged
index.jschanged
render.jschanged
README.mdView
@@ -81,8 +81,9 @@
8181 - `viewer.feed_base`: base url for links to ssb feeds
8282 - `viewer.blob_base`: base url for links to ssb blobs
8383 - `viewer.img_base`: base url for embedded blobs (images)
8484 - `viewer.emoji_base`: base url for emoji images
85 +- `viewer.require_opt_in`: whether to serve content from feeds that have not published a `publicWebHosting` `about` message. default: `true`
8586
8687 ## References
8788
8889 - Concept: [ssb-porthole][]
index.jsView
@@ -49,8 +49,9 @@
4949 feed_base: conf.feed_base || base,
5050 blob_base: conf.blob_base || base,
5151 img_base: conf.img_base || base,
5252 emoji_base: conf.emoji_base || (base + 'emoji/'),
53 + requireOptIn: conf.require_opt_in == null ? true : conf.require_opt_in,
5354 }
5455
5556 defaultOpts.marked = {
5657 gfm: true,
@@ -112,9 +113,11 @@
112113 // formatMsgs(feedId, ext, defaultOpts)
113114 renderRssItem(defaultOpts), wrapRss(about.name, defaultOpts)
114115 );
115116 default:
116- var name = about.publicWebHosting === false ? feedId.substr(0, 10) + '…' : about.name
117 + var publicWebHosting = about.publicWebHosting == null
118 + ? !defaultOpts.requireOptIn : about.publicWebHosting
119 + var name = publicWebHosting ? about.name : feedId.substr(0, 10) + '…'
117120 return pull(
118121 renderAbout(defaultOpts, about,
119122 renderShowAll(showAll, req.url)), wrapPage(name)
120123 );
render.jsView
@@ -113,9 +113,9 @@
113113 'Scuttlebutt')).outerHTML;
114114 }
115115
116116 function renderAbout(opts, about, showAllHTML = "") {
117- if (about.publicWebHosting === false) {
117 + if (about.publicWebHosting === false || (about.publicWebHosting == null && opts.requireOptIn)) {
118118 return pull(
119119 pull.map(renderMsg.bind(this, opts, '')),
120120 wrap(toolTipTop() + '<main>', '</main>' + callToAction())
121121 );
@@ -361,8 +361,9 @@
361361 if (opts.renderFollow == false && c.type == "contact") return ''
362362 if (opts.renderAbout == false && c.type == "about") return ''
363363 if (opts.renderPub == false && c.type == "pub") return ''
364364 if (msg.author.publicWebHosting === false) return h('article', 'User has chosen not to be hosted publicly').outerHTML;
365 + if (msg.author.publicWebHosting == null && opts.requireOptIn) return h('article', 'User has not chosen to be hosted publicly').outerHTML;
365366
366367 var name = encodeURIComponent(msg.key);
367368 return h('article#' + name,
368369 h('header',

Built with git-ssb-web