We good now?

This commit is contained in:
dangered wolf 2022-07-25 19:23:34 -04:00
parent 2bcf9b0a80
commit 6606c11c9f
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
3 changed files with 9 additions and 7 deletions

View file

@ -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"

View file

@ -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;

View file

@ -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(
`<meta name="twitter:image" content="${video.thumbnail_url}"/>`,
`<meta name="twitter:player:stream" content="${video.url}"/>`,
`<meta name="twitter:player:stream:content_type" content="${video.format}"/>`,
`<meta name="twitter:player:height" content="${video.height}"/>`,
`<meta name="twitter:player:width" content="${video.width}"/>`,
@ -96,7 +95,8 @@ export const handleStatus = async (
`<meta name="og:video:secure_url" content="${video.url}"/>`,
`<meta name="og:video:height" content="${video.height}"/>`,
`<meta name="og:video:width" content="${video.width}"/>`,
`<meta name="og:video:type" content="${video.format}"/>`
`<meta name="og:video:type" content="${video.format}"/>`,
`<meta name="twitter:image" content="${video.thumbnail_url}"/>`
);
}
@ -196,7 +196,8 @@ export const handleStatus = async (
headers.push(
`<meta content="${tweet.author.name} (@${tweet.author.screen_name})" property="og:title"/>`,
`<meta content="${sanitizeText(newText)}" property="og:description"/>`
`<meta content="${sanitizeText(newText)}" property="og:description"/>`,
`<meta content="${siteName}" property="og:site_name"/>`
);
/* Special reply handling if authorText is not overriden */