From 27dc258f8458129611384531f788e8eeace92a42 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Tue, 23 Apr 2024 20:07:08 -0400 Subject: [PATCH] Denote videos that are GIFs --- src/embed/status.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/embed/status.ts b/src/embed/status.ts index 14b97e3..99ce762 100644 --- a/src/embed/status.ts +++ b/src/embed/status.ts @@ -469,6 +469,17 @@ export const handleStatus = async ( 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( ``.format( { @@ -479,10 +490,7 @@ export const handleStatus = async ( status: encodeURIComponent(statusId), author: encodeURIComponent(status.author.screen_name || ''), name: status.author.name || '', - provider: - status.embed_card === 'player' && providerEngagementText !== Strings.DEFAULT_AUTHOR_TEXT - ? `&provider=${encodeURIComponent(providerEngagementText)}` - : '' + provider: provider ? `&provider=${encodeURIComponent(provider)}` : '' } ) );