mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
fix inline player not showing up broken from previous commit
This commit is contained in:
parent
c9fdaec997
commit
221ae5b821
1 changed files with 12 additions and 6 deletions
|
@ -40,14 +40,15 @@ function MarkdownLink(props: Props) {
|
||||||
const protocolRegex = new RegExp('^(https?|lbry|mailto)+:', 'i');
|
const protocolRegex = new RegExp('^(https?|lbry|mailto)+:', 'i');
|
||||||
const protocol = href ? protocolRegex.exec(href) : null;
|
const protocol = href ? protocolRegex.exec(href) : null;
|
||||||
|
|
||||||
// Return plain text if no valid url
|
let linkUrlObject;
|
||||||
// Return external link if protocol is http or https
|
try {
|
||||||
// Return local link if protocol is lbry uri
|
linkUrlObject = new URL(decodedUri);
|
||||||
if (!simpleLinks && protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) {
|
} catch (e) {}
|
||||||
const linkUrlObject = new URL(decodedUri);
|
|
||||||
|
let lbryUrlFromLink;
|
||||||
|
if (linkUrlObject) {
|
||||||
const linkDomain = linkUrlObject.host;
|
const linkDomain = linkUrlObject.host;
|
||||||
const isKnownAppDomainLink = KNOWN_APP_DOMAINS.includes(linkDomain);
|
const isKnownAppDomainLink = KNOWN_APP_DOMAINS.includes(linkDomain);
|
||||||
let lbryUrlFromLink;
|
|
||||||
if (isKnownAppDomainLink) {
|
if (isKnownAppDomainLink) {
|
||||||
const linkPathname = decodeURIComponent(
|
const linkPathname = decodeURIComponent(
|
||||||
linkUrlObject.pathname.startsWith('//') ? linkUrlObject.pathname.slice(2) : linkUrlObject.pathname.slice(1)
|
linkUrlObject.pathname.startsWith('//') ? linkUrlObject.pathname.slice(2) : linkUrlObject.pathname.slice(1)
|
||||||
|
@ -58,7 +59,12 @@ function MarkdownLink(props: Props) {
|
||||||
lbryUrlFromLink = possibleLbryUrl;
|
lbryUrlFromLink = possibleLbryUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return plain text if no valid url
|
||||||
|
// Return external link if protocol is http or https
|
||||||
|
// Return local link if protocol is lbry uri
|
||||||
|
if ((protocol && protocol[0] === 'lbry:' && isURIValid(decodedUri)) || lbryUrlFromLink) {
|
||||||
element = (
|
element = (
|
||||||
<ClaimLink
|
<ClaimLink
|
||||||
uri={lbryUrlFromLink || decodedUri}
|
uri={lbryUrlFromLink || decodedUri}
|
||||||
|
|
Loading…
Add table
Reference in a new issue