forked from MarseyWorld/MarseyWorld
remove 414 and change 413 msgs
* use 413 for videos and put explanatory text there * add style text for 413 as wellmaster
parent
3482f97bfb
commit
ca7fa50419
|
@ -282,8 +282,7 @@ ERROR_TITLES = {
|
|||
405: "Method Not Allowed",
|
||||
406: "Too Many Pings",
|
||||
409: "Conflict",
|
||||
413: "Max image/audio size is 8 MB (16 MB for paypigs)",
|
||||
414: "Max video size is 32 MB (64 MB for paypigs)",
|
||||
413: "Payload Too Large",
|
||||
415: "Unsupported Media Type",
|
||||
417: "Image already exists!",
|
||||
418: "WEBM videos are not allowed",
|
||||
|
@ -299,8 +298,7 @@ ERROR_MSGS = {
|
|||
405: "idk how anyone gets this error but if you see this, remember to follow @carpathianflorist<BR>the original error text here talked about internet gremlins and wtf",
|
||||
406: "Max limit is 5 for comments and 50 for posts",
|
||||
409: "There's a conflict between what you're trying to do and what you or someone else has done and because of that you can't do what you're trying to do. So maybe like... don't try and do that? Sorry not sorry",
|
||||
413: "Max image/audio size is 8 MB (16 MB for paypigs)",
|
||||
414: "Max video size is 32 MB (64 MB for paypigs)",
|
||||
413: "That's a heckin' chonker of a file! Please make it smaller or maybe like upload it somewhere else idk",
|
||||
415: "Please upload only Image, Video, or Audio files!",
|
||||
417: "Image already exists!",
|
||||
418: "Please convert your video to MP4 and re-upload it!",
|
||||
|
@ -316,8 +314,7 @@ ERROR_MARSEYS = {
|
|||
405: "marseyretard",
|
||||
406: "marseyrage",
|
||||
409: "marseynoyou",
|
||||
413: "marseyretard",
|
||||
414: "marseychonker2",
|
||||
413: "marseychonker2",
|
||||
415: "marseydetective",
|
||||
418: "marseytea",
|
||||
429: "marseyrentfree",
|
||||
|
@ -396,8 +393,8 @@ SIGNUP_FOLLOW_ID = 0
|
|||
NOTIFICATION_THREAD = 1
|
||||
|
||||
MAX_IMAGE_SIZE_BANNER_RESIZED_MB = 1
|
||||
MAX_IMAGE_SIZE_MB = 8
|
||||
MAX_IMAGE_SIZE_MB_PATRON = 16
|
||||
MAX_IMAGE_AUDIO_SIZE_MB = 8
|
||||
MAX_IMAGE_AUDIO_SIZE_MB_PATRON = 16
|
||||
MAX_VIDEO_SIZE_MB = 32
|
||||
MAX_VIDEO_SIZE_MB_PATRON = 64
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ def process_audio(file):
|
|||
file.save(name)
|
||||
|
||||
size = os.stat(name).st_size
|
||||
if size > MAX_IMAGE_SIZE_MB_PATRON * 1024 * 1024 or not g.v.patron and size > MAX_IMAGE_SIZE_MB * 1024 * 1024:
|
||||
if size > MAX_IMAGE_AUDIO_SIZE_MB_PATRON * 1024 * 1024 or not g.v.patron and size > MAX_IMAGE_AUDIO_SIZE_MB * 1024 * 1024:
|
||||
os.remove(name)
|
||||
abort(413)
|
||||
abort(413, f"Max image/audio size is {MAX_IMAGE_AUDIO_SIZE_MB} MB ({MAX_IMAGE_AUDIO_SIZE_MB_PATRON} MB for paypigs)")
|
||||
|
||||
media = g.db.query(Media).filter_by(filename=name, kind='audio').one_or_none()
|
||||
if media: g.db.delete(media)
|
||||
|
@ -92,7 +92,7 @@ def process_video(file):
|
|||
size = os.stat(old).st_size
|
||||
if SITE_NAME != 'WPD' and (size > MAX_VIDEO_SIZE_MB * 1024 * 1024 or not g.v.patron and size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024):
|
||||
os.remove(old)
|
||||
abort(414)
|
||||
abort(413, f"Max video size is {MAX_IMAGE_AUDIO_SIZE_MB} MB ({MAX_VIDEO_SIZE_MB_PATRON} MB for paypigs)")
|
||||
|
||||
extension = file.filename.split('.')[-1].lower()
|
||||
if extension not in ['avi', 'mp4', 'webm', 'm4v', 'mov', 'mkv']:
|
||||
|
@ -125,9 +125,9 @@ def process_video(file):
|
|||
def process_image(filename=None, resize=0, trim=False, uploader=None, patron=False, db=None):
|
||||
size = os.stat(filename).st_size
|
||||
|
||||
if size > MAX_IMAGE_SIZE_MB_PATRON * 1024 * 1024 or not patron and size > MAX_IMAGE_SIZE_MB * 1024 * 1024:
|
||||
if size > MAX_IMAGE_AUDIO_SIZE_MB_PATRON * 1024 * 1024 or not patron and size > MAX_IMAGE_AUDIO_SIZE_MB * 1024 * 1024:
|
||||
os.remove(filename)
|
||||
abort(413)
|
||||
abort(413, f"Max image/audio size is {MAX_IMAGE_AUDIO_SIZE_MB} MB ({MAX_IMAGE_AUDIO_SIZE_MB_PATRON} MB for paypigs)")
|
||||
|
||||
i = Image.open(filename)
|
||||
|
||||
|
@ -156,7 +156,7 @@ def process_image(filename=None, resize=0, trim=False, uploader=None, patron=Fal
|
|||
if resize in (300,400,1200):
|
||||
if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_MB * 1024 * 1024:
|
||||
os.remove(filename)
|
||||
abort(413)
|
||||
abort(413, f"Max size for banners, sidebars, and badges is {MAX_IMAGE_SIZE_BANNER_RESIZED_MB}")
|
||||
|
||||
if resize == 1200:
|
||||
path = f'files/assets/images/{SITE_NAME}/banners'
|
||||
|
|
Loading…
Reference in New Issue