use canonical_url for everything #187
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
consider soon
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
Invalid
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
Tom's Wishlist
type: bug
type: discussion
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/lbry-redux#187
Loading…
Reference in a new issue
No description provided.
Delete branch "canonical_url"
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?
This populates
byUri
withclaim.canonical_url
instead ofclaim.permanent_url
everywhere.Once both apps are moved over, the search results should move to canonical_url too:
https://github.com/lbryio/lighthouse/issues/163
lbryURI.js
buildURI
andparseURI
did not work properly with canonical_urlsbuildURI
andparseURI
will continue to work the same (which will be unreliable if using claim.canonical_url), but will blow up your console with errors in dev mode ifclaimId
,claimName
orcontentName
is passed in. These should be replaced with{stream}/{channel}Name
,{stream}/{channel}ClaimId
.@ -57,3 +67,3 @@
if (isChannel) {
if (includesChannel) {
if (!channelName) {
Not sure the best way to do this.
Should
path
include the claimId? Should there bepath
andpathClaimId
?@ -54,3 +63,2 @@
const isChannel = claimName.startsWith('@');
const channelName = isChannel ? claimName.slice(1) : claimName;
const includesChannel = streamNameOrChannelName.startsWith('@');
This could possibly be removed or moved. The function is called parseURI, not parseAndValidateURI. It's one thing to error if invalid characters make it impossible to parse, but I think erroring on a validly structured URI is probably incorrect here.
@ -57,3 +67,3 @@
if (isChannel) {
if (includesChannel) {
if (!channelName) {
According to https://lbry.tech/spec#urls, the
path
should include the channel name, claim name, and any modifiers. The path is everything between the scheme and any query parameters.Channel name, claim name, and any modifiers would be sub-properties of the path (and could potentially be returned/parsed out by this function as well).
@lyoshenka, please correct me if I'm wrong about this.
@seanyesmunt we should try to have this function use the same names and standards that the spec specifies. If you think we should do something different than what the spec says, we can also consider amending the spec.
@ -328,10 +328,10 @@ export function doClaimSearch(
why keep two sets of URIs?
@ -66,26 +66,25 @@ function handleClaimAction(state: State, action: any): State {
const byId = Object.assign({}, state.byId);
const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
URI or URL? are we consistent with when we use one vs. the other?
IMO, all of @lbryio/appsquad should be on the same page with the URI type that is promised/implied by default when used without modifiers. Is it the user input URI, the canonical URI, the permanent URI (canonical means something close to permanent so I dislike using both of these as adjectives), or something else?
Then when we have structures like
xxxByUri
, we understand that it is implicitly promising an index by that URI type, without needing to always specify which type, and specifying only when we deviate from the default.@ -54,3 +63,2 @@
const isChannel = claimName.startsWith('@');
const channelName = isChannel ? claimName.slice(1) : claimName;
const includesChannel = streamNameOrChannelName.startsWith('@');
I like removing validation from this. We already have
isURIValid
to validate@kauffj this is ready for another review.
It's a bigger change than I wanted to make but it's already making some of the url code way easier to follow without trying to figure out if a name is for the channel or stream. Let me know what you think.
LGTM. If there was a part of this you were specifically concerned about lmk, but it all looked fine to me.
should this be a Flow type?