master
Aevann1 2021-08-25 19:23:38 +02:00
parent 15a8e45c2c
commit ab75913051
3 changed files with 5 additions and 6 deletions

View File

@ -38,7 +38,8 @@ def upload_file(file=None, resize=False, png=False):
data={'image': base64.b64encode(f.read())} 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) req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}, data=data)
resp = req.json()['data'] resp = req.json()['data']
url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg") + "?maxwidth=9999" url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg")
if "_d." in url: url += "?maxwidth=9999"
except: return except: return
new_image = Image(text=url, deletehash=resp["deletehash"]) new_image = Image(text=url, deletehash=resp["deletehash"])

View File

@ -557,7 +557,8 @@ def submit_post(v):
else: else:
url = "" url = ""
if "i.imgur.com" in url: url = url.replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg") + "?maxwidth=9999" 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"
body = request.form.get("body", "") body = request.form.get("body", "")
# check for duplicate # check for duplicate

View File

@ -156,9 +156,6 @@ def unsubscribe(v, post_id):
@auth_required @auth_required
def message2(v, username): def message2(v, username):
if v.zzz:
abort(418)
user = get_user(username, v=v) user = get_user(username, v=v)
if user.is_blocking: return {"error": "You're blocking this user."}, 403 if user.is_blocking: return {"error": "You're blocking this user."}, 403
if user.is_blocked: return {"error": "This user is blocking you."}, 403 if user.is_blocked: return {"error": "This user is blocking you."}, 403
@ -191,7 +188,7 @@ def message2(v, username):
except Exception as e: except Exception as e:
print(e) print(e)
return redirect('/notifications?messages=true') return redirect(request.referrer)
@app.get("/2faqr/<secret>") @app.get("/2faqr/<secret>")
@auth_required @auth_required