This commit is contained in:
Dylan
2024-05-17 16:59:34 +01:00
parent 21c45d9dba
commit af4520eb3a
2 changed files with 9 additions and 2 deletions

7
templates/rawimage.html Normal file
View File

@ -0,0 +1,7 @@
{% extends 'base.html' %} {% block head %}
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{ media['url'] }}" />
<meta http-equiv="refresh" content="0; url = {{ media['url'] }}" /> {% endblock %} {% block body %} Redirecting you to the video in a moment. <a href="{{ media['url'] }}">Or click here.</a> {% endblock %}

View File

@ -179,7 +179,7 @@ def twitfix(sub_path):
embedIndex = int(sub_path[-1])-1
sub_path = sub_path[:-2]
if request.url.startswith("https://api.vx"): # Directly return the API response if the request is from the API
if request.url.startswith("https://api.vx") or request.url.startswith("http://api.vx"): # Directly return the API response if the request is from the API
return tweetData
elif directEmbed: # direct embed
# direct embeds should always prioritize the main tweet, so don't check for qrt
@ -194,7 +194,7 @@ def twitfix(sub_path):
embedIndex = 0
media = tweetData['media_extended'][embedIndex]
if media['type'] == "image":
return redirect(media['url'], 302)
return render_template("rawimage.html",media=media)
elif media['type'] == "video" or media['type'] == "gif":
return render_template("rawvideo.html",media=media)
else: # full embed