use [file] instead of <file>
parent
78c941c7b5
commit
6e200d332e
|
@ -254,7 +254,7 @@ function changename(s1,s2,textarea) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const ta = document.getElementById(textarea);
|
const ta = document.getElementById(textarea);
|
||||||
ta.value = ta.value.replace(/<file>\n/g, "")
|
ta.value = ta.value.replace(/[file]\n/g, "")
|
||||||
if (ta.value) {
|
if (ta.value) {
|
||||||
ta.value += '\n'
|
ta.value += '\n'
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ function changename(s1,s2,textarea) {
|
||||||
let filename = '';
|
let filename = '';
|
||||||
for (const e of files) {
|
for (const e of files) {
|
||||||
filename += e.name.substr(0, 22) + ', ';
|
filename += e.name.substr(0, 22) + ', ';
|
||||||
ta.value += '<file>\n'
|
ta.value += '[file]\n'
|
||||||
}
|
}
|
||||||
document.getElementById(s1).innerHTML = escapeHTML(filename.slice(0, -2));
|
document.getElementById(s1).innerHTML = escapeHTML(filename.slice(0, -2));
|
||||||
|
|
||||||
|
|
|
@ -32,19 +32,19 @@ def process_files(files, v, body):
|
||||||
if files:
|
if files:
|
||||||
media_ratelimit(v)
|
media_ratelimit(v)
|
||||||
|
|
||||||
while body.count('<file>') < len(files):
|
while body.count('[file]') < len(files):
|
||||||
body += '\n<file>'
|
body += '\n[file]'
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
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)
|
url = process_image(name, v)
|
||||||
body = body.replace('<file>', f"![]({url})", 1)
|
body = body.replace('[file]', f"![]({url})", 1)
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
body = body.replace('<file>', f"{SITE_FULL}{process_video(file, v)}", 1)
|
body = body.replace('[file]', f"{SITE_FULL}{process_video(file, v)}", 1)
|
||||||
elif file.content_type.startswith('audio/'):
|
elif file.content_type.startswith('audio/'):
|
||||||
body = body.replace('<file>', f"{SITE_FULL}{process_audio(file, v)}", 1)
|
body = body.replace('[file]', f"{SITE_FULL}{process_audio(file, v)}", 1)
|
||||||
else:
|
else:
|
||||||
abort(415)
|
abort(415)
|
||||||
return body
|
return body
|
||||||
|
@ -237,8 +237,8 @@ def process_dm_images(v, user, body):
|
||||||
|
|
||||||
files = request.files.getlist('file')[:8]
|
files = request.files.getlist('file')[:8]
|
||||||
|
|
||||||
while body.count('<file>') < len(files):
|
while body.count('[file]') < len(files):
|
||||||
body += '\n<file>'
|
body += '\n[file]'
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.content_type.startswith('image/'):
|
if file.content_type.startswith('image/'):
|
||||||
|
@ -268,7 +268,7 @@ def process_dm_images(v, user, body):
|
||||||
try: url = req['files'][0]['url']
|
try: url = req['files'][0]['url']
|
||||||
except: abort(400, req['description'])
|
except: abort(400, req['description'])
|
||||||
|
|
||||||
body = body.replace('<file>', url, 1)
|
body = body.replace('[file]', url, 1)
|
||||||
|
|
||||||
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
|
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
|
||||||
if user:
|
if user:
|
||||||
|
|
|
@ -155,8 +155,8 @@ def comment(v:User):
|
||||||
if request.files.get("file") and not g.is_tor:
|
if request.files.get("file") and not g.is_tor:
|
||||||
files = request.files.getlist('file')[:8]
|
files = request.files.getlist('file')[:8]
|
||||||
|
|
||||||
while body.count('<file>') < len(files):
|
while body.count('[file]') < len(files):
|
||||||
body += '\n<file>'
|
body += '\n[file]'
|
||||||
|
|
||||||
if files:
|
if files:
|
||||||
media_ratelimit(v)
|
media_ratelimit(v)
|
||||||
|
@ -204,11 +204,11 @@ def comment(v:User):
|
||||||
purge_files_in_cache(f"https://{SITE}/assets/images/badges/{badge.id}.webp")
|
purge_files_in_cache(f"https://{SITE}/assets/images/badges/{badge.id}.webp")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
abort(400, str(e))
|
abort(400, str(e))
|
||||||
body = body.replace('<file>', f"![]({image})", 1)
|
body = body.replace('[file]', f"![]({image})", 1)
|
||||||
elif file.content_type.startswith('video/'):
|
elif file.content_type.startswith('video/'):
|
||||||
body = body.replace('<file>', f"{SITE_FULL}{process_video(file, v)}", 1)
|
body = body.replace('[file]', f"{SITE_FULL}{process_video(file, v)}", 1)
|
||||||
elif file.content_type.startswith('audio/'):
|
elif file.content_type.startswith('audio/'):
|
||||||
body = body.replace('<file>', f"{SITE_FULL}{process_audio(file, v)}", 1)
|
body = body.replace('[file]', f"{SITE_FULL}{process_audio(file, v)}", 1)
|
||||||
else:
|
else:
|
||||||
abort(415)
|
abort(415)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue