forked from MarseyWorld/MarseyWorld
sdf
parent
a4b0565b5a
commit
94e6eb1ef6
|
@ -36,8 +36,8 @@ def get_logged_in_user():
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
if v and v.patron:
|
if v and v.patron:
|
||||||
if request.content_length > 16 * 1024 * 1024: abort(413)
|
if request.content_length and request.content_length > 16 * 1024 * 1024: abort(413)
|
||||||
elif request.content_length > 8 * 1024 * 1024: abort(413)
|
elif request.content_length and request.content_length > 8 * 1024 * 1024: abort(413)
|
||||||
|
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
|
|
@ -890,14 +890,14 @@ def submit_post(v, sub=None):
|
||||||
title_html = filter_emojis_only(title, graceful=True)
|
title_html = filter_emojis_only(title, graceful=True)
|
||||||
|
|
||||||
if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
|
if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
|
||||||
return {"error":"You can only type marseys!"}, 403
|
return error("You can only type marseys!")
|
||||||
|
|
||||||
if len(title_html) > 1500: return error("Rendered title is too big!")
|
if len(title_html) > 1500: return error("Rendered title is too big!")
|
||||||
|
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
return {"error":"You have to type more than 280 characters!"}, 403
|
return error("You have to type more than 280 characters!")
|
||||||
elif v.bird and len(body) > 140:
|
elif v.bird and len(body) > 140:
|
||||||
return {"error":"You have to type less than 140 characters!"}, 403
|
return error("You have to type less than 140 characters!")
|
||||||
|
|
||||||
|
|
||||||
embed = None
|
embed = None
|
||||||
|
@ -1078,12 +1078,12 @@ def submit_post(v, sub=None):
|
||||||
file.save("video.mp4")
|
file.save("video.mp4")
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
|
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return error("Video upload timed out, please try again!")
|
||||||
try: url = req['link']
|
try: url = req['link']
|
||||||
except:
|
except:
|
||||||
error = req['error']
|
err = req['error']
|
||||||
if error == 'File exceeds max duration': error += ' (60 seconds)'
|
if err == 'File exceeds max duration': err += ' (60 seconds)'
|
||||||
return {"error": error}, 400
|
return error(err)
|
||||||
if url.endswith('.'): url += 'mp4'
|
if url.endswith('.'): url += 'mp4'
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else:
|
else:
|
||||||
|
@ -1092,7 +1092,7 @@ def submit_post(v, sub=None):
|
||||||
body_html = sanitize(body)
|
body_html = sanitize(body)
|
||||||
|
|
||||||
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||||
return {"error":"You can only type marseys!"}, 403
|
return error("You can only type marseys!")
|
||||||
|
|
||||||
if len(body_html) > 40000: return error("Submission body_html too long! (max 40k characters)")
|
if len(body_html) > 40000: return error("Submission body_html too long! (max 40k characters)")
|
||||||
|
|
||||||
|
@ -1187,12 +1187,12 @@ def submit_post(v, sub=None):
|
||||||
file.save("video.mp4")
|
file.save("video.mp4")
|
||||||
with open("video.mp4", 'rb') as f:
|
with open("video.mp4", 'rb') as f:
|
||||||
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
|
try: req = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)], timeout=5).json()['data']
|
||||||
except requests.Timeout: return {"error": "Video upload timed out, please try again!"}
|
except requests.Timeout: return error("Video upload timed out, please try again!")
|
||||||
try: url = req['link']
|
try: url = req['link']
|
||||||
except:
|
except:
|
||||||
error = req['error']
|
err = req['error']
|
||||||
if error == 'File exceeds max duration': error += ' (60 seconds)'
|
if err == 'File exceeds max duration': err += ' (60 seconds)'
|
||||||
return {"error": error}, 400
|
return error(err)
|
||||||
if url.endswith('.'): url += 'mp4'
|
if url.endswith('.'): url += 'mp4'
|
||||||
post.url = url
|
post.url = url
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -68,8 +68,8 @@ Text 2
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Images</td>
|
<td>Images</td>
|
||||||
<td>https://i.imgur.com/Lf6dfPO.jpg</td>
|
<td>https://i.imgur.com/SwVuagI_d.webp</td>
|
||||||
<td><img loading="lazy" alt="example image" referrerpolicy="no-referrer" src="https://i.imgur.com/Lf6dfPO.jpg"></td>
|
<td><img loading="lazy" alt="example image" referrerpolicy="no-referrer" src="https://i.imgur.com/SwVuagI_d.webp"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Youtube Videos</td>
|
<td>Youtube Videos</td>
|
||||||
|
@ -94,12 +94,12 @@ Text 2
|
||||||
<tr>
|
<tr>
|
||||||
<td>Large Emojis</td>
|
<td>Large Emojis</td>
|
||||||
<td>:#marseylove:</td>
|
<td>:#marseylove:</td>
|
||||||
<td><img loading="lazy" data-bs-toggle="tooltip" class="emoji-lg" alt=":!marseylove:" title=":!marseylove:" src="/e/marseylove.webp"></td>
|
<td><img loading="lazy" data-bs-toggle="tooltip" b alt=":marseylove:" title=":marseylove:" src="/e/marseylove.webp"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Large Mirrored Emojis</td>
|
<td>Large Mirrored Emojis</td>
|
||||||
<td>:#!marseylove:</td>
|
<td>:#!marseylove:</td>
|
||||||
<td><img loading="lazy" data-bs-toggle="tooltip" class="emoji-lg mirrored" alt=":!marseylove:" title=":!marseylove:" src="/e/marseylove.webp"></td>
|
<td><img loading="lazy" data-bs-toggle="tooltip" b alt=":!marseylove:" title=":!marseylove:" src="/e/marseylove.webp"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Random Marsey</td>
|
<td>Random Marsey</td>
|
||||||
|
@ -173,7 +173,7 @@ Text 2
|
||||||
<tr>
|
<tr>
|
||||||
<td>Spoilers</td>
|
<td>Spoilers</td>
|
||||||
<td>||bussy > gussy||</td>
|
<td>||bussy > gussy||</td>
|
||||||
<td><p class="spoiler">bussy > gussy</p></td>
|
<td><p><spoiler>bussy > gussy</spoiler></p></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Username Mention</td>
|
<td>Username Mention</td>
|
||||||
|
@ -182,8 +182,8 @@ Text 2
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Subreddit Mention</td>
|
<td>Subreddit Mention</td>
|
||||||
<td>r/{{SITE_NAME}}</td>
|
<td>r/drama</td>
|
||||||
<td><a class="d-inline-block" rel="nofollow noopener noreferrer" href="https://www.reddit.com/r/{{SITE_NAME}}/">r/{{SITE_NAME}}</a></td>
|
<td><a class="d-inline-block" rel="nofollow noopener noreferrer" href="https://www.reddit.com/r/drama/">r/drama</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Redditor Mention</td>
|
<td>Redditor Mention</td>
|
||||||
|
|
Loading…
Reference in New Issue