add referral code to embed links
This commit is contained in:
parent
d677468fe8
commit
85e2ee28a3
3 changed files with 15 additions and 5 deletions
|
@ -13,14 +13,15 @@ type Props = {
|
|||
claim: Claim,
|
||||
includeStartTime: boolean,
|
||||
startTime: number,
|
||||
referralCode: ?string,
|
||||
};
|
||||
|
||||
export default function EmbedTextArea(props: Props) {
|
||||
const { doToast, snackMessage, label, claim, includeStartTime, startTime } = props;
|
||||
const { doToast, snackMessage, label, claim, includeStartTime, startTime, referralCode } = props;
|
||||
const { claim_id: claimId, name } = claim;
|
||||
const input = useRef();
|
||||
|
||||
const streamUrl = generateEmbedUrl(name, claimId, includeStartTime, startTime);
|
||||
const streamUrl = generateEmbedUrl(name, claimId, includeStartTime, startTime, referralCode);
|
||||
let embedText = `<iframe id="lbry-iframe" width="560" height="315" src="${streamUrl}" allowfullscreen></iframe>`;
|
||||
|
||||
function copyToClipboard() {
|
||||
|
|
|
@ -162,6 +162,7 @@ function SocialShare(props: Props) {
|
|||
claim={claim}
|
||||
includeStartTime={includeStartTime}
|
||||
startTime={startTimeSeconds}
|
||||
referralCode={referralCode}
|
||||
/>
|
||||
)}
|
||||
{showClaimLinks && (
|
||||
|
|
|
@ -6,9 +6,17 @@ function generateStreamUrl(claimName, claimId) {
|
|||
return `${LBRY_WEB_STREAMING_API}/content/claims/${claimName}/${claimId}/stream`;
|
||||
}
|
||||
|
||||
function generateEmbedUrl(claimName, claimId, includeStartTime, startTime) {
|
||||
const queryParam = includeStartTime ? `?t=${startTime}` : '';
|
||||
return `${URL}/$/embed/${claimName}/${claimId}${queryParam}`;
|
||||
function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, referralLink) {
|
||||
let urlParams = new URLSearchParams();
|
||||
if (includeStartTime && startTime) {
|
||||
urlParams.append('t', startTime);
|
||||
}
|
||||
|
||||
if (referralLink) {
|
||||
urlParams.append('r', referralLink);
|
||||
}
|
||||
|
||||
return `${URL}/$/embed/${claimName}/${claimId}?${urlParams.toString()}`;
|
||||
}
|
||||
|
||||
function generateDownloadUrl(claimName, claimId) {
|
||||
|
|
Loading…
Reference in a new issue