Small fix for Activity embeds + non-discord clients

This commit is contained in:
Dylan
2026-02-01 16:17:41 +00:00
parent fb8abeb904
commit 68cc985b8c
2 changed files with 7 additions and 3 deletions
+4 -1
View File
@@ -35,7 +35,10 @@ def tweetDataToActivity(tweetData,embedIndex = -1):
if media is not None:
media = deepcopy(media)
if media['type'] == "gif":
media['type'] = "gifv"
if "/convert.avif" in media['url']:
media['type'] = "image"
else:
media['type'] = "gifv"
if 'thumbnail_url' not in media:
media['thumbnail_url'] = media['url']
if media['type'] == "image" and "?" not in media['url']:
+3 -2
View File
@@ -433,7 +433,8 @@ def twitfix(sub_path):
elif not embeddingMedia:
return Response(renderTextTweetEmbed(tweetData),headers={"Cache-Tag": "embed"})
else:
media = determineMediaToEmbed(embedTweetData,embedIndex)
tryGifConversion = "Discord" in user_agent
media = determineMediaToEmbed(embedTweetData,embedIndex,convertGif=tryGifConversion)
suffix=""
if "suffix" in media:
suffix = media["suffix"]
@@ -442,7 +443,7 @@ def twitfix(sub_path):
elif media['type'] == "video":
return Response(renderVideoTweetEmbed(tweetData,media,appnameSuffix=suffix,embedIndex=embedIndex),headers={"Cache-Tag": "embed"})
elif media['type'] == "gif":
if "originalUrl" in media and media["url"] != media["originalUrl"]:
if "originalUrl" in media and media["url"] != media["originalUrl"] and tryGifConversion:
return Response(renderImageTweetEmbed(tweetData,media['url'] , appnameSuffix=suffix,embedIndex=embedIndex),headers={"Cache-Tag": "embed"})
else:
return Response(renderVideoTweetEmbed(tweetData,media,appnameSuffix=suffix,embedIndex=embedIndex),headers={"Cache-Tag": "embed"})