Multisite 555 #605
No reviewers
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
Osprey
priority: blocker
priority: high
priority: low
priority: medium
protocol dependent
resilience
Tom's Wishlist
type: bug
type: discussion
type: error handling
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/spee.ch#605
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "multisite-555"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#555
This PR uses 4 new configuration options: closedRegistration, serveOnlyApproved, publishOnlyApproved, approvedChannels
There is no option to not show Publish in the navbar as described in the issue. Publish and Login are hidden based on the options defined
It's also not "disable publishing for non-authenticated users" but "only allow publishes from whitelisted channels/users"
Some comments
@ -28,16 +28,17 @@ class NavigationLinks extends React.Component {
}
Should this logic exist in a reducer, index.js, or somewhere that isn't the component itself?
@ -11,0 +8,4 @@
twitter : 'default twitter',
defaultDescription : 'default description',
defaultThumbnail : 'default thumbnail',
closedRegistration : false,
Doesn't need to be handled in this PR, but rather than defaulting these in JavaScript, we should be including a default config file that includes these values.
Also, we should pick better defaults :)
I haven't thought this through thoroughly, but are all of these necessary or can some be inferred?
E.g. if there is a list of approved channels, doesn't that imply to only serve content from them and allow publishing to them?
This function exists twice in two different places (it's also in
server/utils
)@ -6,3 +9,4 @@
const LONG_CLAIM_LENGTH = 40;
/*
"40" should be defined somewhere, presumably on whatever class / structure defines what a Claim is.
Additionally, if
shortId
andlongId
are used as special values, they should also be defined constants.@ -95,3 +105,3 @@
if (error.name === CLAIM_TAKEN) {
if ([CLAIM_TAKEN, UNAPPROVED_CHANNEL].includes(error.name)) {
res.status(400).json({
success: false,
Is there a way to write this function that doesn't rely on using an exception for control flow?
@ -358,3 +359,4 @@
Claim.fetchClaim = function (name, claimId) {
logger.debug(`Claim.resolveClaim: ${name} ${claimId}`);
return new Promise((resolve, reject) => {
this
This logic should probably not be in
resolveClaim
itself, and instead either in the controller or in a wrapper method likeresolveApprovedClaim
orresolveClaimForSite
.@ -10,2 +11,4 @@
},
(username, password, done) => {
if (closedRegistration) {
return done('Registration is disabled');
Should this be an exception rather than an early exit? If sites with
closedRegistration=true
are not expected to call this function, it should be probably be an exception.Is creating a separate utility function and file like this the recommended approach for Express / Sequalize / Node?
I would have expected this to be grouped with other functions that operate on claims.
@ -11,0 +8,4 @@
twitter : 'default twitter',
defaultDescription : 'default description',
defaultThumbnail : 'default thumbnail',
closedRegistration : false,
https://github.com/lbryio/spee.ch/issues/606
I'm trying to learn best practices for these tools as I go so I'm not exactly sure, but I'm moving this to the utils folder shared by server and client, making it a pure function, and passing in
approvedChannels
from the config file.This was a small amount of extra effort now to account for other configurations e.g. a spee.ch instance that serves all content but only publishes selected channels.
@ -11,0 +8,4 @@
twitter : 'default twitter',
defaultDescription : 'default description',
defaultThumbnail : 'default thumbnail',
closedRegistration : false,
The default config is on the server. I think having silly things like "default thumbnail" are useful in development which is the only time these values should ever render.
@ -10,2 +11,4 @@
},
(username, password, done) => {
if (closedRegistration) {
return done('Registration is disabled');
That would have the same result and I can't find a way to make it any cleaner/simpler than this.
@ -28,16 +28,17 @@ class NavigationLinks extends React.Component {
}
moved to index.js