Default to require opt-in for publicWebHosting
This commit is contained in:
@@ -82,6 +82,7 @@ e.g. `--viewer.port 8807`.
|
|||||||
- `viewer.blob_base`: base url for links to ssb blobs
|
- `viewer.blob_base`: base url for links to ssb blobs
|
||||||
- `viewer.img_base`: base url for embedded blobs (images)
|
- `viewer.img_base`: base url for embedded blobs (images)
|
||||||
- `viewer.emoji_base`: base url for emoji images
|
- `viewer.emoji_base`: base url for emoji images
|
||||||
|
- `viewer.require_opt_in`: whether to serve content from feeds that have not published a `publicWebHosting` `about` message. default: `true`
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ exports.init = function (sbot, config) {
|
|||||||
blob_base: conf.blob_base || base,
|
blob_base: conf.blob_base || base,
|
||||||
img_base: conf.img_base || base,
|
img_base: conf.img_base || base,
|
||||||
emoji_base: conf.emoji_base || (base + 'emoji/'),
|
emoji_base: conf.emoji_base || (base + 'emoji/'),
|
||||||
|
requireOptIn: conf.require_opt_in == null ? true : conf.require_opt_in,
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultOpts.marked = {
|
defaultOpts.marked = {
|
||||||
@@ -113,7 +114,9 @@ exports.init = function (sbot, config) {
|
|||||||
renderRssItem(defaultOpts), wrapRss(about.name, defaultOpts)
|
renderRssItem(defaultOpts), wrapRss(about.name, defaultOpts)
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
var name = about.publicWebHosting === false ? feedId.substr(0, 10) + '…' : about.name
|
var publicWebHosting = about.publicWebHosting == null
|
||||||
|
? !defaultOpts.requireOptIn : about.publicWebHosting
|
||||||
|
var name = publicWebHosting ? about.name : feedId.substr(0, 10) + '…'
|
||||||
return pull(
|
return pull(
|
||||||
renderAbout(defaultOpts, about,
|
renderAbout(defaultOpts, about,
|
||||||
renderShowAll(showAll, req.url)), wrapPage(name)
|
renderShowAll(showAll, req.url)), wrapPage(name)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function toolTipTop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderAbout(opts, about, showAllHTML = "") {
|
function renderAbout(opts, about, showAllHTML = "") {
|
||||||
if (about.publicWebHosting === false) {
|
if (about.publicWebHosting === false || (about.publicWebHosting == null && opts.requireOptIn)) {
|
||||||
return pull(
|
return pull(
|
||||||
pull.map(renderMsg.bind(this, opts, '')),
|
pull.map(renderMsg.bind(this, opts, '')),
|
||||||
wrap(toolTipTop() + '<main>', '</main>' + callToAction())
|
wrap(toolTipTop() + '<main>', '</main>' + callToAction())
|
||||||
@@ -362,6 +362,7 @@ function renderMsg(opts, id, msg) {
|
|||||||
if (opts.renderAbout == false && c.type == "about") return ''
|
if (opts.renderAbout == false && c.type == "about") return ''
|
||||||
if (opts.renderPub == false && c.type == "pub") return ''
|
if (opts.renderPub == false && c.type == "pub") return ''
|
||||||
if (msg.author.publicWebHosting === false) return h('article', 'User has chosen not to be hosted publicly').outerHTML;
|
if (msg.author.publicWebHosting === false) return h('article', 'User has chosen not to be hosted publicly').outerHTML;
|
||||||
|
if (msg.author.publicWebHosting == null && opts.requireOptIn) return h('article', 'User has not chosen to be hosted publicly').outerHTML;
|
||||||
|
|
||||||
var name = encodeURIComponent(msg.key);
|
var name = encodeURIComponent(msg.key);
|
||||||
return h('article#' + name,
|
return h('article#' + name,
|
||||||
|
|||||||
Reference in New Issue
Block a user