exempt localhost from size restrictions

master
Aevann 2024-10-22 17:16:26 +03:00
parent c99dc358cb
commit ade05ae2bc
2 changed files with 3 additions and 1 deletions

View File

@ -523,6 +523,8 @@ else patron = 'patron'
function check_file_size(input, file) { function check_file_size(input, file) {
if (!file) return false if (!file) return false
if (location.host == 'localhost') return true
let max_size let max_size
let max_size_patron let max_size_patron
let type let type

View File

@ -171,7 +171,7 @@ def process_video(file, v):
file.save(old) file.save(old)
size = os.stat(old).st_size size = os.stat(old).st_size
if size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024 or (not v.patron and size > MAX_VIDEO_SIZE_MB * 1024 * 1024): if not IS_LOCALHOST and (size > MAX_VIDEO_SIZE_MB_PATRON * 1024 * 1024 or (not v.patron and size > MAX_VIDEO_SIZE_MB * 1024 * 1024)):
os.remove(old) os.remove(old)
stop(413, f"Max video size is {MAX_VIDEO_SIZE_MB} MB ({MAX_VIDEO_SIZE_MB_PATRON} MB for {patron}s)") stop(413, f"Max video size is {MAX_VIDEO_SIZE_MB} MB ({MAX_VIDEO_SIZE_MB_PATRON} MB for {patron}s)")