Denote videos that are GIFs

This commit is contained in:
dangered wolf 2024-04-23 20:07:08 -04:00
parent cdbcd65914
commit 27dc258f84
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58

View file

@ -469,6 +469,17 @@ export const handleStatus = async (
providerEngagementText = Strings.DEFAULT_AUTHOR_TEXT; providerEngagementText = Strings.DEFAULT_AUTHOR_TEXT;
} }
let provider = '';
const mediaType = overrideMedia ?? status.media.videos?.[0]?.type;
if (mediaType === 'gif') {
provider = `GIF - ${Constants.BRANDING_NAME}`;
} else if (status.embed_card === 'player' && providerEngagementText !== Strings.DEFAULT_AUTHOR_TEXT) {
provider = providerEngagementText
}
// Now you can use the 'provider' variable
headers.push( headers.push(
`<link rel="alternate" href="{base}/owoembed?text={text}&status={status}&author={author}{provider}" type="application/json+oembed" title="{name}">`.format( `<link rel="alternate" href="{base}/owoembed?text={text}&status={status}&author={author}{provider}" type="application/json+oembed" title="{name}">`.format(
{ {
@ -479,10 +490,7 @@ export const handleStatus = async (
status: encodeURIComponent(statusId), status: encodeURIComponent(statusId),
author: encodeURIComponent(status.author.screen_name || ''), author: encodeURIComponent(status.author.screen_name || ''),
name: status.author.name || '', name: status.author.name || '',
provider: provider: provider ? `&provider=${encodeURIComponent(provider)}` : ''
status.embed_card === 'player' && providerEngagementText !== Strings.DEFAULT_AUTHOR_TEXT
? `&provider=${encodeURIComponent(providerEngagementText)}`
: ''
} }
) )
); );