Take 2 encoding test
This commit is contained in:
parent
185c2d8496
commit
5ee2f40608
2 changed files with 19 additions and 2 deletions
|
@ -25,6 +25,22 @@ function generateEmbedUrl(claimName, claimId, includeStartTime, startTime, refer
|
||||||
.replace(/\)/g, '%29')}/${claimId}?${urlParams.toString()}`;
|
.replace(/\)/g, '%29')}/${claimId}?${urlParams.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateEmbedUrlEncoded(claimName, claimId, includeStartTime, startTime, referralLink) {
|
||||||
|
let urlParams = new URLSearchParams();
|
||||||
|
if (includeStartTime && startTime) {
|
||||||
|
urlParams.append('t', startTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (referralLink) {
|
||||||
|
urlParams.append('r', referralLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${URL}/%24/embed/${encodeURIComponent(claimName)
|
||||||
|
.replace(/'/g, '%27')
|
||||||
|
.replace(/\(/g, '%28')
|
||||||
|
.replace(/\)/g, '%29')}/${claimId}?${urlParams.toString()}`;
|
||||||
|
}
|
||||||
|
|
||||||
function generateEmbedIframeData(src) {
|
function generateEmbedIframeData(src) {
|
||||||
const width = '560';
|
const width = '560';
|
||||||
const height = '315';
|
const height = '315';
|
||||||
|
@ -79,6 +95,7 @@ module.exports = {
|
||||||
generateDownloadUrl,
|
generateDownloadUrl,
|
||||||
generateEmbedIframeData,
|
generateEmbedIframeData,
|
||||||
generateEmbedUrl,
|
generateEmbedUrl,
|
||||||
|
generateEmbedUrlEncoded,
|
||||||
generateStreamUrl,
|
generateStreamUrl,
|
||||||
getParameterByName,
|
getParameterByName,
|
||||||
getThumbnailCdnUrl,
|
getThumbnailCdnUrl,
|
||||||
|
|
|
@ -2,7 +2,7 @@ const { URL, SITE_NAME, PROXY_URL, THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH } = require
|
||||||
|
|
||||||
const {
|
const {
|
||||||
generateEmbedIframeData,
|
generateEmbedIframeData,
|
||||||
generateEmbedUrl,
|
generateEmbedUrlEncoded,
|
||||||
getParameterByName,
|
getParameterByName,
|
||||||
getThumbnailCdnUrl,
|
getThumbnailCdnUrl,
|
||||||
escapeHtmlProperty,
|
escapeHtmlProperty,
|
||||||
|
@ -54,7 +54,7 @@ function generateOEmbedData(claim, referrerQuery) {
|
||||||
const authorUrl = authorClaim ? `${URL}/${authorUrlPath}` : null;
|
const authorUrl = authorClaim ? `${URL}/${authorUrlPath}` : null;
|
||||||
const thumbnailUrl = value && value.thumbnail && value.thumbnail.url && getThumbnailCdnUrl(value.thumbnail.url);
|
const thumbnailUrl = value && value.thumbnail && value.thumbnail.url && getThumbnailCdnUrl(value.thumbnail.url);
|
||||||
const videoUrl =
|
const videoUrl =
|
||||||
encodeURIComponent(generateEmbedUrl(claim.name, claim.claim_id)) +
|
generateEmbedUrlEncoded(claim.name, claim.claim_id) +
|
||||||
(referrerQuery ? `r=${encodeURIComponent(escapeHtmlProperty(referrerQuery))}` : '');
|
(referrerQuery ? `r=${encodeURIComponent(escapeHtmlProperty(referrerQuery))}` : '');
|
||||||
|
|
||||||
const { html, width, height } = generateEmbedIframeData(videoUrl);
|
const { html, width, height } = generateEmbedIframeData(videoUrl);
|
||||||
|
|
Loading…
Reference in a new issue