remotes/1693045480750635534/spooky-22
Aevann1 2021-11-30 20:25:41 +02:00
parent 31e4214620
commit 7423d9e522
2 changed files with 16 additions and 1 deletions

View File

@ -755,6 +755,16 @@ def submit_post(v):
body = body.replace('I ', f'@{v.username} ')
body = censor_slurs2(body).upper().replace(' ME ', f' @{v.username} ')
if request.files.get("file2") and request.headers.get("cf-ipcountry") != "T1":
file=request.files["file2"]
if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400
name = f'/images/{int(time.time())}{secrets.token_urlsafe(2)}.webp'
file.save(name)
url = request.host_url[:-1] + process_image(name)
body += f"\n\n![]({url})"
body_html = sanitize(CustomRenderer().render(mistletoe.Document(body)))
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400

View File

@ -117,7 +117,12 @@
<label class="btn btn-secondary format d-inline-block m-0" for="emoji-reply-btn">
<div id="emoji-reply-btn" onclick="loadEmojis('post-text')" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Add Emoji"><i class="fas fa-smile-beam"></i></div>
</label>
<label class="format btn btn-secondary m-0 ml-1 {% if v %}d-inline-block{% else %}d-none{% endif %}" for="file-upload-submit">
<div id="filename-show-submit"><i class="far fa-image"></i></div>
<input id="file-upload-submit" type="file" name="file2" accept="image/*" {% if request.headers.get('cf-ipcountry')=="T1" %}disabled{% endif %} onchange="document.getElementById('filename-show-submit').innerHTML='image';" hidden>
</label>
<pre></pre>
<div class="form-text text-small"><a href="/formatting" target="_blank">Formatting help</a></div>
<pre></pre>