From af4520eb3a5960dfd288272901e718fc68a60040 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 17 May 2024 16:59:34 +0100 Subject: [PATCH] Fix #201 --- templates/rawimage.html | 7 +++++++ twitfix.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 templates/rawimage.html diff --git a/templates/rawimage.html b/templates/rawimage.html new file mode 100644 index 0000000..d0b4f4c --- /dev/null +++ b/templates/rawimage.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} {% block head %} + + + + + + {% endblock %} {% block body %} Redirecting you to the video in a moment. Or click here. {% endblock %} \ No newline at end of file diff --git a/twitfix.py b/twitfix.py index e3d0b27..a44a469 100644 --- a/twitfix.py +++ b/twitfix.py @@ -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