Commit 7123fbcab15c43bbb962d1312a465fddf164493c
Default to require opt-in for publicWebHosting
cel committed on 8/17/2018, 10:32:42 PMParent: ba6d7cd3abf79e5283853b32cbebf218dae8c981
Files changed
README.md | changed |
index.js | changed |
render.js | changed |
README.md | ||
---|---|---|
@@ -81,8 +81,9 @@ | ||
81 | 81 … | - `viewer.feed_base`: base url for links to ssb feeds |
82 | 82 … | - `viewer.blob_base`: base url for links to ssb blobs |
83 | 83 … | - `viewer.img_base`: base url for embedded blobs (images) |
84 | 84 … | - `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` | |
85 | 86 … | |
86 | 87 … | ## References |
87 | 88 … | |
88 | 89 … | - Concept: [ssb-porthole][] |
index.js | ||
---|---|---|
@@ -49,8 +49,9 @@ | ||
49 | 49 … | feed_base: conf.feed_base || base, |
50 | 50 … | blob_base: conf.blob_base || base, |
51 | 51 … | img_base: conf.img_base || base, |
52 | 52 … | emoji_base: conf.emoji_base || (base + 'emoji/'), |
53 … | + requireOptIn: conf.require_opt_in == null ? true : conf.require_opt_in, | |
53 | 54 … | } |
54 | 55 … | |
55 | 56 … | defaultOpts.marked = { |
56 | 57 … | gfm: true, |
@@ -112,9 +113,11 @@ | ||
112 | 113 … | // formatMsgs(feedId, ext, defaultOpts) |
113 | 114 … | renderRssItem(defaultOpts), wrapRss(about.name, defaultOpts) |
114 | 115 … | ); |
115 | 116 … | 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) + '…' | |
117 | 120 … | return pull( |
118 | 121 … | renderAbout(defaultOpts, about, |
119 | 122 … | renderShowAll(showAll, req.url)), wrapPage(name) |
120 | 123 … | ); |
render.js | ||
---|---|---|
@@ -113,9 +113,9 @@ | ||
113 | 113 … | 'Scuttlebutt')).outerHTML; |
114 | 114 … | } |
115 | 115 … | |
116 | 116 … | function renderAbout(opts, about, showAllHTML = "") { |
117 | - if (about.publicWebHosting === false) { | |
117 … | + if (about.publicWebHosting === false || (about.publicWebHosting == null && opts.requireOptIn)) { | |
118 | 118 … | return pull( |
119 | 119 … | pull.map(renderMsg.bind(this, opts, '')), |
120 | 120 … | wrap(toolTipTop() + '<main>', '</main>' + callToAction()) |
121 | 121 … | ); |
@@ -361,8 +361,9 @@ | ||
361 | 361 … | if (opts.renderFollow == false && c.type == "contact") return '' |
362 | 362 … | if (opts.renderAbout == false && c.type == "about") return '' |
363 | 363 … | if (opts.renderPub == false && c.type == "pub") return '' |
364 | 364 … | 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; | |
365 | 366 … | |
366 | 367 … | var name = encodeURIComponent(msg.key); |
367 | 368 … | return h('article#' + name, |
368 | 369 … | h('header', |
Built with git-ssb-web