forked from MarseyWorld/MarseyWorld
max image and video size are constants now
* the error pages still need to be fixedmaster
parent
318a20250c
commit
dcd875c40c
|
@ -395,6 +395,12 @@ GIFT_NOTIF_ID = 5
|
||||||
SIGNUP_FOLLOW_ID = 0
|
SIGNUP_FOLLOW_ID = 0
|
||||||
NOTIFICATION_THREAD = 1
|
NOTIFICATION_THREAD = 1
|
||||||
|
|
||||||
|
MAX_IMAGE_SIZE_BANNER_RESIZED_MB = 1
|
||||||
|
MAX_IMAGE_SIZE_MB = 8
|
||||||
|
MAX_IMAGE_SIZE_MB_PATRON = 16
|
||||||
|
MAX_VIDEO_SIZE_MB = 32
|
||||||
|
MAX_VIDEO_SIZE_MB_PATRON = 64
|
||||||
|
|
||||||
if SITE == 'rdrama.net':
|
if SITE == 'rdrama.net':
|
||||||
FEATURES['PRONOUNS'] = True
|
FEATURES['PRONOUNS'] = True
|
||||||
FEATURES['HOUSES'] = True
|
FEATURES['HOUSES'] = True
|
||||||
|
|
|
@ -43,7 +43,7 @@ def process_audio(file):
|
||||||
file.save(name)
|
file.save(name)
|
||||||
|
|
||||||
size = os.stat(name).st_size
|
size = os.stat(name).st_size
|
||||||
if size > 16 * 1024 * 1024 or not g.v.patron and size > 8 * 1024 * 1024:
|
if size > MAX_IMAGE_SIZE_MB_PATRON * 1024 * 1024 or not g.v.patron and size > MAX_IMAGE_SIZE_MB * 1024 * 1024:
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ def process_video(file):
|
||||||
file.save(old)
|
file.save(old)
|
||||||
|
|
||||||
size = os.stat(old).st_size
|
size = os.stat(old).st_size
|
||||||
if SITE_NAME != 'WPD' and (size > 32 * 1024 * 1024 or not g.v.patron and size > 64 * 1024 * 1024):
|
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)
|
os.remove(old)
|
||||||
abort(414)
|
abort(414)
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ def process_video(file):
|
||||||
def process_image(filename=None, resize=0, trim=False, uploader=None, patron=False, db=None):
|
def process_image(filename=None, resize=0, trim=False, uploader=None, patron=False, db=None):
|
||||||
size = os.stat(filename).st_size
|
size = os.stat(filename).st_size
|
||||||
|
|
||||||
if size > 16 * 1024 * 1024 or not patron and size > 8 * 1024 * 1024:
|
if size > MAX_IMAGE_SIZE_MB_PATRON * 1024 * 1024 or not patron and size > MAX_IMAGE_SIZE_MB * 1024 * 1024:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ def process_image(filename=None, resize=0, trim=False, uploader=None, patron=Fal
|
||||||
|
|
||||||
|
|
||||||
if resize in (300,400,1200):
|
if resize in (300,400,1200):
|
||||||
if os.stat(filename).st_size > 1 * 1024 * 1024:
|
if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_MB * 1024 * 1024:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
abort(413)
|
abort(413)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue