From 6606c11c9f3c38b72247826c4c4e34b781e11438 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Mon, 25 Jul 2022 19:23:34 -0400 Subject: [PATCH] We good now? --- .env.example | 2 +- src/api.ts | 5 +++-- src/status.ts | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 6e437cd..0e17155 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ BRANDING_NAME = "FixTweet" BRANDING_NAME_DISCORD = "FixTweet by @dangeredwolf - Embed videos, polls & more!" DIRECT_MEDIA_DOMAINS = "d.fxtwitter.com,dl.fxtwitter.com,d.pxtwitter.com,d.twittpr.com,dl.pxtwitter.com,dl.twittpr.com" -MOSAIC_DOMAIN_LIST = "mosaic.pxtwitter.com" +MOSAIC_DOMAIN_LIST = "mosaic.fxtwitter.com" API_HOST = "api.fxtwitter.com" HOST_URL = "https://fxtwitter.com" REDIRECT_URL = "https://github.com/dangeredwolf/FixTweet" \ No newline at end of file diff --git a/src/api.ts b/src/api.ts index 01f3495..0ea6a54 100644 --- a/src/api.ts +++ b/src/api.ts @@ -80,14 +80,15 @@ const populateTweetProperties = async ( let mediaObject = processMedia(media); console.log('mediaObject', JSON.stringify(mediaObject)); if (mediaObject) { - apiTweet.twitter_card = 'summary_large_image'; if (mediaObject.type === 'photo') { + apiTweet.twitter_card = 'summary_large_image'; apiTweet.media = apiTweet.media || {}; apiTweet.media.photos = apiTweet.media.photos || []; apiTweet.media.photos.push(mediaObject); console.log('media', apiTweet.media); } else if (mediaObject.type === 'video' || mediaObject.type === 'gif') { + apiTweet.twitter_card = 'player'; apiTweet.media = apiTweet.media || {}; apiTweet.media.video = mediaObject as APIVideo; } @@ -98,7 +99,7 @@ const populateTweetProperties = async ( apiTweet.color = colorFromPalette(mediaList[0].ext_media_color.palette); } - if (apiTweet.media?.photos?.length || 0 > 1) { + if ((apiTweet.media?.photos?.length || 0) > 1) { let mosaic = await handleMosaic(apiTweet.media?.photos || []); if (typeof apiTweet.media !== 'undefined' && mosaic !== null) { apiTweet.media.mosaic = mosaic; diff --git a/src/status.ts b/src/status.ts index 0d21f8c..be9bcd4 100644 --- a/src/status.ts +++ b/src/status.ts @@ -68,6 +68,7 @@ export const handleStatus = async ( if (!tweet.media && tweet.quote?.media) { tweet.media = tweet.quote.media; + tweet.twitter_card = 'summary_large_image'; } let authorText = getAuthorText(tweet) || Strings.DEFAULT_AUTHOR_TEXT; @@ -87,8 +88,6 @@ export const handleStatus = async ( const { video } = tweet.media; headers.push( - ``, - ``, ``, ``, ``, @@ -96,7 +95,8 @@ export const handleStatus = async ( ``, ``, ``, - `` + ``, + `` ); } @@ -196,7 +196,8 @@ export const handleStatus = async ( headers.push( ``, - `` + ``, + `` ); /* Special reply handling if authorText is not overriden */