forked from rDrama/rDrama
webm fix
parent
0368329ac0
commit
20f1e4d9c2
|
@ -206,6 +206,7 @@ def api_comment(v):
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: 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
|
except: return {"error": "Imgur error"}, 400
|
||||||
|
if url.endswith('.'): url += 'mp4'
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else: return {"error": f"Image/Video files only"}, 400
|
else: return {"error": f"Image/Video files only"}, 400
|
||||||
|
|
||||||
|
@ -706,6 +707,7 @@ def edit_comment(cid, v):
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: 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
|
except: return {"error": "Imgur error"}, 400
|
||||||
|
if url.endswith('.'): url += 'mp4'
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else: return {"error": f"Image/Video files only"}, 400
|
else: return {"error": f"Image/Video files only"}, 400
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,6 @@ def publish(pid, v):
|
||||||
@app.get("/submit")
|
@app.get("/submit")
|
||||||
@auth_required
|
@auth_required
|
||||||
def submit_get(v):
|
def submit_get(v):
|
||||||
|
|
||||||
if not v or v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}submit.html",
|
return render_template(f"{template}submit.html",
|
||||||
|
@ -452,6 +451,7 @@ def edit_post(pid, v):
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: 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
|
except: return {"error": "Imgur error"}, 400
|
||||||
|
if url.endswith('.'): url += 'mp4'
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else: return {"error": f"Image/Video files only"}, 400
|
else: return {"error": f"Image/Video files only"}, 400
|
||||||
|
|
||||||
|
@ -944,6 +944,7 @@ def submit_post(v):
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: 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
|
except: return {"error": "Imgur error"}, 400
|
||||||
|
if url.endswith('.'): url += 'mp4'
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
||||||
|
@ -1040,6 +1041,7 @@ def submit_post(v):
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: 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
|
except: return {"error": "Imgur error"}, 400
|
||||||
|
if url.endswith('.'): url += 'mp4'
|
||||||
new_post.url = url
|
new_post.url = url
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400
|
if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400
|
||||||
|
|
|
@ -303,6 +303,7 @@ def settings_profile_post(v):
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: 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
|
except: return {"error": "Imgur error"}, 400
|
||||||
|
if url.endswith('.'): url += 'mp4'
|
||||||
bio += f"\n\n{url}"
|
bio += f"\n\n{url}"
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
||||||
|
|
Loading…
Reference in New Issue