for easier effortposting: increase file limit from 20 to 50, and skip broken images

master
Aevann 2024-11-18 15:45:46 +02:00
parent aadc2e8f56
commit fb573f0d01
2 changed files with 7 additions and 4 deletions

View File

@ -576,9 +576,9 @@ function handle_files(input, newfiles) {
} }
for (let file of newfiles) { for (let file of newfiles) {
if (oldfiles[ta.id].items.length == 20) if (oldfiles[ta.id].items.length == 50)
{ {
window.alert("You can't upload more than 20 files at one time!") window.alert("You can't upload more than 50 files at one time!")
break break
} }

View File

@ -48,7 +48,7 @@ def media_ratelimit(v):
def process_files(files, v, body, is_dm=False, dm_user=None, is_badge_thread=False, comment_body=None): def process_files(files, v, body, is_dm=False, dm_user=None, is_badge_thread=False, comment_body=None):
if g.is_tor or not files.get("file"): return body if g.is_tor or not files.get("file"): return body
files = files.getlist('file')[:20] files = files.getlist('file')[:50]
if files: if files:
media_ratelimit(v) media_ratelimit(v)
@ -61,7 +61,10 @@ def process_files(files, v, body, is_dm=False, dm_user=None, is_badge_thread=Fal
if file.content_type.startswith('image/'): if file.content_type.startswith('image/'):
name = f'/images/{time.time()}'.replace('.','') + '.webp' name = f'/images/{time.time()}'.replace('.','') + '.webp'
file.save(name) file.save(name)
url = process_image(name, v) try: url = process_image(name, v)
except Exception as e:
print(e)
continue
if is_badge_thread: if is_badge_thread:
process_badge_entry(name, v, comment_body) process_badge_entry(name, v, comment_body)
elif file.content_type.startswith('video/'): elif file.content_type.startswith('video/'):