Merge pull request #22 from lyricalpaws/main

Trying to fix images again
This commit is contained in:
Chloe 2022-05-26 23:56:24 +01:00 committed by GitHub
commit e09b46f5e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 21 deletions

View File

@ -1,17 +1,18 @@
{% extends 'base.html' %}
<!--
{{ color }} - Custom Color Code set in the Twxtter Config
{{ appname }} - Custom Appname set in the Twxtter Config
{{ user }} - Username of the Source Tweet
{{ pic }} - Thumbnail Image for a given video
{{ vidlink }} - Direct link back to the source tweet
{{ vidurl }} - Direct MP4 link to the video contained in the tweet
{{ desc }} - Tweet Text
{{ url }} - Base URL of the site hosting Twxtter
{{ urlDesc }} - HTTP Encoded Tweet Text
{{ urlUser }} - HTTP Encoded Username
{{ urlLink }} - HTTP Encoded source link
{{ pfp }} - URL of the posters PFP
{{ color }} - Custom Color Code set in the TwitFix Config
{{ appname }} - Custom Appname set in the TwitFix Config
{{ user }} - Username of the Source Tweet
{{ pic }} - Thumbnail Image for a given video
{{ vidlink }} - Direct link back to the source tweet
{{ vidurl }} - Direct MP4 link to the video contained in the tweet
{{ desc }} - Tweet Text
{{ url }} - Base URL of the site hosting TwitFix
{{ urlDesc }} - HTTP Encoded Tweet Text
{{ urlUser }} - HTTP Encoded Username
{{ urlLink }} - HTTP Encoded source link
{{ pfp }} - URL of the posters PFP
{{ imagecount }} - Message that can contain the number of images in an album
-->
{% block head %}
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
@ -26,10 +27,10 @@
<meta property="og:description" content="{{ desc }}" />
<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user=Twitter&link={{ urlLink }}&ttype=photo" type="application/json+oembed" title="{{ user }}">
<link rel="alternate" href="{{ url }}/oembed.json?desc={{ urlUser }}&user={{ imagecount }}&link={{ urlLink }}&ttype=photo" type="application/json+oembed" title="{{ user }}">
<meta http-equiv = "refresh" content = "0; url = {{ tweetLink }}" />
{% endblock %}
{% block body %}
Redirecting you to the tweet in a moment. <a href="{{ tweetLink }}">Or click here.</a>
{% endblock %}
{% endblock %}

View File

@ -755,6 +755,7 @@ def embed(video_link, vnf, image, raw=False):
urlDesc = urllib.parse.quote(desc)
urlLink = urllib.parse.quote(video_link)
likeDisplay = "\n\n💖 " + str(vnf["likes"]) + " 🔁 " + str(vnf["rts"]) + "\n"
imagecount = "Twitter"
try:
if vnf["type"] == "":
@ -779,15 +780,13 @@ def embed(video_link, vnf, image, raw=False):
vnf["rts"] = 0
vnf["time"] = 0
print(" ➤ [ X ] Failed QRT check - old VNF object")
appNamePost = ""
if vnf["type"] == "Text": # Change the template based on tweet type
template = "text.html"
if vnf["type"] == "Image":
print(" ➤ [ T ] vnf type is Image")
if vnf["images"][4] != "1":
appNamePost = " - Image " + str(image+1) + "/" + str(vnf["images"][4])
print(f" ➤ [ T ] Setting appNamePost to {appNamePost}")
image = vnf["images"][image]
if vnf["images"][4] != "1":
imagecount = "Twitter (" + vnf["images"][4] + " images in post)"
if raw == True:
template = "img.html"
else:
@ -807,7 +806,7 @@ def embed(video_link, vnf, image, raw=False):
if vnf["nsfw"] == True:
color = "#800020" # Red
print(f'{appNamePost=}')
return render_template(
template,
likes=vnf["likes"],
@ -819,10 +818,11 @@ def embed(video_link, vnf, image, raw=False):
vidurl=vnf["url"],
desc=desc,
pic=image,
imagecount=imagecount,
user=vnf["uploader"],
video_link=video_link,
color=color,
appname=f"{config['config']['appname']}{appNamePost}",
appname=config['config']['appname'],
repo=config["config"]["repo"],
url=config["config"]["url"],
urlDesc=urlDesc,