keep it simple, use playerUri for images too
This commit is contained in:
@@ -580,85 +580,85 @@ describe('parseEmbedPlayerFromUrl', () => {
|
|||||||
|
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
playerUri: 'https://i.giphy.com/media/gifId/giphy.gif',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: 'https://media1.tenor.com/m/gifId/someName.gif',
|
playerUri: 'https://media1.tenor.com/m/gifId/someName.gif',
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: 'https://tenor.com/view/gifId.gif',
|
playerUri: 'https://tenor.com/view/gifId.gif',
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: 'https://tenor.com/view/gifId.gif',
|
playerUri: 'https://tenor.com/view/gifId.gif',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: 'https://c.tenor.com/gifId/tenor.gif',
|
playerUri: 'https://c.tenor.com/gifId/tenor.gif',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: 'https://c.tenor.com/gifId/tenor.webp',
|
playerUri: 'https://c.tenor.com/gifId/tenor.webp',
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ export type EmbedPlayerParams =
|
|||||||
| {type: 'apple_music_album'; albumId: string; playerUri: string}
|
| {type: 'apple_music_album'; albumId: string; playerUri: string}
|
||||||
| {type: 'apple_music_song'; songId: string; playerUri: string}
|
| {type: 'apple_music_song'; songId: string; playerUri: string}
|
||||||
| {type: 'vimeo_video'; videoId: string; playerUri: string}
|
| {type: 'vimeo_video'; videoId: string; playerUri: string}
|
||||||
| {type: 'giphy_gif'; imageUri: string}
|
| {type: 'giphy_gif'; playerUri: string}
|
||||||
| {type: 'tenor_gif'; imageUri: string}
|
| {type: 'tenor_gif'; playerUri: string}
|
||||||
|
|
||||||
export function parseEmbedPlayerFromUrl(
|
export function parseEmbedPlayerFromUrl(
|
||||||
url: string,
|
url: string,
|
||||||
@@ -188,7 +188,7 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
if (id) {
|
if (id) {
|
||||||
return {
|
return {
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: `https://i.giphy.com/media/${id}/giphy.gif`,
|
playerUri: `https://i.giphy.com/media/${id}/giphy.gif`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,12 +205,12 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
if (idOrFilename === 'giphy.gif' || idOrFilename === 'giphy.gif') {
|
if (idOrFilename === 'giphy.gif' || idOrFilename === 'giphy.gif') {
|
||||||
return {
|
return {
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: `https://i.giphy.com/media/${trackingOrId}/giphy.gif`,
|
playerUri: `https://i.giphy.com/media/${trackingOrId}/giphy.gif`,
|
||||||
}
|
}
|
||||||
} else if (filename === 'giphy.gif' || filename === 'giphy.gif') {
|
} else if (filename === 'giphy.gif' || filename === 'giphy.gif') {
|
||||||
return {
|
return {
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: `https://i.giphy.com/media/${idOrFilename}/giphy.gif`,
|
playerUri: `https://i.giphy.com/media/${idOrFilename}/giphy.gif`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,14 +224,14 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
if (mediaOrFilename === 'media' && filename) {
|
if (mediaOrFilename === 'media' && filename) {
|
||||||
return {
|
return {
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: `https://i.giphy.com/media/${
|
playerUri: `https://i.giphy.com/media/${
|
||||||
filename.split('.')[0]
|
filename.split('.')[0]
|
||||||
}/giphy.gif`,
|
}/giphy.gif`,
|
||||||
}
|
}
|
||||||
} else if (mediaOrFilename) {
|
} else if (mediaOrFilename) {
|
||||||
return {
|
return {
|
||||||
type: 'giphy_gif',
|
type: 'giphy_gif',
|
||||||
imageUri: `https://i.giphy.com/media/${
|
playerUri: `https://i.giphy.com/media/${
|
||||||
mediaOrFilename.split('.')[0]
|
mediaOrFilename.split('.')[0]
|
||||||
}/giphy.gif`,
|
}/giphy.gif`,
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
if (parts.length === 4 && filename?.split('.').pop() === 'gif') {
|
if (parts.length === 4 && filename?.split('.').pop() === 'gif') {
|
||||||
return {
|
return {
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: url,
|
playerUri: url,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: `${url}${!includesExt ? '.gif' : ''}`,
|
playerUri: `${url}${!includesExt ? '.gif' : ''}`,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ export function parseEmbedPlayerFromUrl(
|
|||||||
if (ext === 'gif' || ext === 'webp') {
|
if (ext === 'gif' || ext === 'webp') {
|
||||||
return {
|
return {
|
||||||
type: 'tenor_gif',
|
type: 'tenor_gif',
|
||||||
imageUri: url,
|
playerUri: url,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user