handle colons maybe
This commit is contained in:
parent
34dfd384e4
commit
64ce7aa99c
4 changed files with 52 additions and 10 deletions
27
dist/bundle.es.js
vendored
27
dist/bundle.es.js
vendored
|
@ -1722,6 +1722,25 @@ function convertToShareLink(URL) {
|
||||||
}, true, 'https://open.lbry.com/');
|
}, true, 'https://open.lbry.com/');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function splitBySeparator(uri) {
|
||||||
|
const protocolLength = 7;
|
||||||
|
return uri.startsWith('lbry://') ? uri.slice(protocolLength).split(/[#:*]/) : uri.split(/#:\*\$/);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isURIEqual(uriA, uriB) {
|
||||||
|
const parseA = parseURI(normalizeURI(uriA));
|
||||||
|
const parseB = parseURI(normalizeURI(uriB));
|
||||||
|
if (parseA.isChannel) {
|
||||||
|
if (parseB.isChannel && parseA.channelClaimId === parseB.channelClaimId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (parseA.streamClaimId === parseB.streamClaimId) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// underscore's deep equal function
|
// underscore's deep equal function
|
||||||
// https://github.com/jashkenas/underscore/blob/master/underscore.js#L1189
|
// https://github.com/jashkenas/underscore/blob/master/underscore.js#L1189
|
||||||
|
@ -2468,7 +2487,7 @@ const makeSelectClaimForUri = (uri, returnRepost = true) => reselect.createSelec
|
||||||
const channelUrl = claim.signing_channel && (claim.signing_channel.canonical_url || claim.signing_channel.permanent_url);
|
const channelUrl = claim.signing_channel && (claim.signing_channel.canonical_url || claim.signing_channel.permanent_url);
|
||||||
|
|
||||||
return _extends$3({}, repostedClaim, {
|
return _extends$3({}, repostedClaim, {
|
||||||
repost_url: uri,
|
repost_url: normalizeURI(uri),
|
||||||
repost_channel_url: channelUrl,
|
repost_channel_url: channelUrl,
|
||||||
repost_bid_amount: claim && claim.meta && claim.meta.effective_amount
|
repost_bid_amount: claim && claim.meta && claim.meta.effective_amount
|
||||||
});
|
});
|
||||||
|
@ -2719,9 +2738,9 @@ const makeSelectPendingClaimForUri = uri => reselect.createSelector(selectPendin
|
||||||
return matchingClaim || null;
|
return matchingClaim || null;
|
||||||
});
|
});
|
||||||
|
|
||||||
const makeSelectTotalItemsForChannel = uri => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri]);
|
const makeSelectTotalItemsForChannel = uri => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[normalizeURI(uri)]);
|
||||||
|
|
||||||
const makeSelectTotalPagesForChannel = (uri, pageSize = 10) => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri] && Math.ceil(byUri[uri] / pageSize));
|
const makeSelectTotalPagesForChannel = (uri, pageSize = 10) => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri] && Math.ceil(byUri[normalizeURI(uri)] / pageSize));
|
||||||
|
|
||||||
const makeSelectNsfwCountFromUris = uris => reselect.createSelector(selectClaimsByUri, claims => uris.reduce((acc, uri) => {
|
const makeSelectNsfwCountFromUris = uris => reselect.createSelector(selectClaimsByUri, claims => uris.reduce((acc, uri) => {
|
||||||
const claim = claims[uri];
|
const claim = claims[uri];
|
||||||
|
@ -7943,6 +7962,7 @@ exports.formatFullPrice = formatFullPrice;
|
||||||
exports.isClaimNsfw = isClaimNsfw;
|
exports.isClaimNsfw = isClaimNsfw;
|
||||||
exports.isNameValid = isNameValid;
|
exports.isNameValid = isNameValid;
|
||||||
exports.isURIClaimable = isURIClaimable;
|
exports.isURIClaimable = isURIClaimable;
|
||||||
|
exports.isURIEqual = isURIEqual;
|
||||||
exports.isURIValid = isURIValid;
|
exports.isURIValid = isURIValid;
|
||||||
exports.makeSelectAbandoningClaimById = makeSelectAbandoningClaimById;
|
exports.makeSelectAbandoningClaimById = makeSelectAbandoningClaimById;
|
||||||
exports.makeSelectAmountForUri = makeSelectAmountForUri;
|
exports.makeSelectAmountForUri = makeSelectAmountForUri;
|
||||||
|
@ -8158,5 +8178,6 @@ exports.selectWalletState = selectWalletState;
|
||||||
exports.selectWalletUnlockPending = selectWalletUnlockPending;
|
exports.selectWalletUnlockPending = selectWalletUnlockPending;
|
||||||
exports.selectWalletUnlockResult = selectWalletUnlockResult;
|
exports.selectWalletUnlockResult = selectWalletUnlockResult;
|
||||||
exports.selectWalletUnlockSucceeded = selectWalletUnlockSucceeded;
|
exports.selectWalletUnlockSucceeded = selectWalletUnlockSucceeded;
|
||||||
|
exports.splitBySeparator = splitBySeparator;
|
||||||
exports.toQueryString = toQueryString;
|
exports.toQueryString = toQueryString;
|
||||||
exports.walletReducer = walletReducer;
|
exports.walletReducer = walletReducer;
|
||||||
|
|
|
@ -52,6 +52,8 @@ export {
|
||||||
isURIClaimable,
|
isURIClaimable,
|
||||||
isNameValid,
|
isNameValid,
|
||||||
convertToShareLink,
|
convertToShareLink,
|
||||||
|
splitBySeparator,
|
||||||
|
isURIEqual,
|
||||||
} from 'lbryURI';
|
} from 'lbryURI';
|
||||||
|
|
||||||
// middlware
|
// middlware
|
||||||
|
|
|
@ -325,3 +325,22 @@ export function convertToShareLink(URL: string) {
|
||||||
'https://open.lbry.com/'
|
'https://open.lbry.com/'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function splitBySeparator(uri: string) {
|
||||||
|
const protocolLength = 7;
|
||||||
|
return uri.startsWith('lbry://') ? uri.slice(protocolLength).split(/[#:*]/) : uri.split(/#:\*\$/);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isURIEqual(uriA: string, uriB: string) {
|
||||||
|
const parseA = parseURI(normalizeURI(uriA));
|
||||||
|
const parseB = parseURI(normalizeURI(uriB));
|
||||||
|
if (parseA.isChannel) {
|
||||||
|
if (parseB.isChannel && parseA.channelClaimId === parseB.channelClaimId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (parseA.streamClaimId === parseB.streamClaimId) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...repostedClaim,
|
...repostedClaim,
|
||||||
repost_url: uri,
|
repost_url: normalizeURI(uri),
|
||||||
repost_channel_url: channelUrl,
|
repost_channel_url: channelUrl,
|
||||||
repost_bid_amount: claim && claim.meta && claim.meta.effective_amount,
|
repost_bid_amount: claim && claim.meta && claim.meta.effective_amount,
|
||||||
};
|
};
|
||||||
|
@ -630,13 +630,13 @@ export const makeSelectPendingClaimForUri = (uri: string) =>
|
||||||
export const makeSelectTotalItemsForChannel = (uri: string) =>
|
export const makeSelectTotalItemsForChannel = (uri: string) =>
|
||||||
createSelector(
|
createSelector(
|
||||||
selectChannelClaimCounts,
|
selectChannelClaimCounts,
|
||||||
byUri => byUri && byUri[uri]
|
byUri => byUri && byUri[normalizeURI(uri)]
|
||||||
);
|
);
|
||||||
|
|
||||||
export const makeSelectTotalPagesForChannel = (uri: string, pageSize: number = 10) =>
|
export const makeSelectTotalPagesForChannel = (uri: string, pageSize: number = 10) =>
|
||||||
createSelector(
|
createSelector(
|
||||||
selectChannelClaimCounts,
|
selectChannelClaimCounts,
|
||||||
byUri => byUri && byUri[uri] && Math.ceil(byUri[uri] / pageSize)
|
byUri => byUri && byUri[uri] && Math.ceil(byUri[normalizeURI(uri)] / pageSize)
|
||||||
);
|
);
|
||||||
|
|
||||||
export const makeSelectNsfwCountFromUris = (uris: Array<string>) =>
|
export const makeSelectNsfwCountFromUris = (uris: Array<string>) =>
|
||||||
|
|
Loading…
Reference in a new issue