master
Aevann1 2022-01-06 16:20:45 +02:00
parent 3533dbb17b
commit 245654a5a7
9 changed files with 18 additions and 17 deletions

View File

@ -202,7 +202,8 @@ def api_comment(v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
except: return {"error": "Imgur error"}, 400
body += f"\n\n{url}"
else: return {"error": f"Image/Video files only"}, 400
@ -701,7 +702,8 @@ def edit_comment(cid, v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
except: return {"error": "Imgur error"}, 400
body += f"\n\n{url}"
else: return {"error": f"Image/Video files only"}, 400

View File

@ -450,7 +450,8 @@ def edit_post(pid, v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
except: return {"error": "Imgur error"}, 400
body += f"\n\n{url}"
else: return {"error": f"Image/Video files only"}, 400
@ -939,7 +940,8 @@ def submit_post(v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
except: return {"error": "Imgur error"}, 400
body += f"\n\n{url}"
else:
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
@ -1034,7 +1036,8 @@ def submit_post(v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
except: return {"error": "Imgur error"}, 400
new_post.url = url
else:
if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400

View File

@ -301,7 +301,8 @@ def settings_profile_post(v):
elif file.content_type.startswith('video/'):
file.save("video.mp4")
with open("video.mp4", 'rb') as f:
url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
try: url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link']
except: return {"error": "Imgur error"}, 400
bio += f"\n\n{url}"
else:
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
@ -607,11 +608,6 @@ def settings_security_post(v):
if new_email == v.email:
return render_template("settings_security.html", v=v, error="That email is already yours!")
existing = g.db.query(User.id).filter(User.id != v.id,
func.lower(User.email) == new_email.lower()).one_or_none()
if existing:
return render_template("settings_security.html", v=v, error="That email address is already in use.")
url = f"https://{app.config['SERVER_NAME']}/activate"
now = int(time.time())

View File

@ -15,7 +15,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=9">
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=10">
{% if v.agendaposter %}
<style>
html {

View File

@ -8,7 +8,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64">
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=9">
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=10">
{% if v.agendaposter %}
<style>
html {

View File

@ -6,7 +6,7 @@
{% block content %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=9">
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=10">
{% if v.agendaposter %}
<style>
html {

View File

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=9">
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=10">
{% if v.agendaposter %}
<style>
html {

View File

@ -39,7 +39,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=9">
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=10">
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">

View File

@ -26,7 +26,7 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=9">
<link rel="stylesheet" href="/static/assets/css/main.css?a=64"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=10">
{% if v.agendaposter %}
<style>
html {