forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-30 21:17:16 +02:00
parent 5cf101936b
commit ece31240ca
2 changed files with 15 additions and 21 deletions

View File

@ -1,20 +0,0 @@
from .get import *
def expand_url(post_url, fragment_url):
# convert src into full url
if fragment_url.startswith("https://"):
return fragment_url
elif fragment_url.startswith("http://"):
return f"https://{fragment_url.split('http://')[1]}"
elif fragment_url.startswith('//'):
return f"https:{fragment_url}"
elif fragment_url.startswith('/'):
parsed_url = urlparse(post_url)
return f"https://{parsed_url.netloc}{fragment_url}"
else:
return f"{post_url}{'/' if not post_url.endswith('/') else ''}{fragment_url}"
def thumbnail_thread(pid, debug=False):
return True, "Success"

View File

@ -10,7 +10,6 @@ from files.helpers.sanitize import *
from files.helpers.filters import *
from files.helpers.markdown import *
from files.helpers.session import *
from files.helpers.thumbs import *
from files.helpers.alerts import send_notification
from files.helpers.discord import send_message
from files.helpers.const import *
@ -426,6 +425,21 @@ def check_processing_thread(v, post, link):
def thumbnail_thread(pid):
def expand_url(post_url, fragment_url):
# convert src into full url
if fragment_url.startswith("https://"):
return fragment_url
elif fragment_url.startswith("http://"):
return f"https://{fragment_url.split('http://')[1]}"
elif fragment_url.startswith('//'):
return f"https:{fragment_url}"
elif fragment_url.startswith('/'):
parsed_url = urlparse(post_url)
return f"https://{parsed_url.netloc}{fragment_url}"
else:
return f"{post_url}{'/' if not post_url.endswith('/') else ''}{fragment_url}"
db = db_session()
post = db.query(Submission).filter_by(id=pid).first()