forked from MarseyWorld/MarseyWorld
fdfd
parent
8d07b5be0a
commit
c93eff4c69
|
@ -39,8 +39,10 @@ def upload_file(file=None, resize=False, png=False):
|
|||
data={'image': base64.b64encode(f.read())}
|
||||
req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}, data=data)
|
||||
resp = req.json()['data']
|
||||
url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "_d." in url: url += "?maxwidth=9999"
|
||||
url = resp['link']
|
||||
if not "_d" in url:
|
||||
url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "_d." in url: url += "?maxwidth=9999"
|
||||
except: return
|
||||
|
||||
new_image = Image(text=url, deletehash=resp["deletehash"])
|
||||
|
|
|
@ -520,8 +520,9 @@ def submit_post(v):
|
|||
if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"):
|
||||
url = url.replace("https://streamable.com/", "https://streamable.com/e/")
|
||||
|
||||
if "i.imgur.com" in url: url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "_d." in url: url += "?maxwidth=9999"
|
||||
if "i.imgur.com" in url and "_d" not in url:
|
||||
url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
|
||||
if "_d." in url: url += "?maxwidth=9999"
|
||||
|
||||
repost = g.db.query(Submission).join(Submission.submission_aux).filter(
|
||||
SubmissionAux.url.ilike(url),
|
||||
|
|
Loading…
Reference in New Issue