forked from MarseyWorld/MarseyWorld
gfdg
parent
9651df148f
commit
e4ced2b992
|
@ -22,6 +22,7 @@ services:
|
|||
- HCAPTCHA_SECRET=3435tdfsdudebussylmaoxxt43
|
||||
- YOUTUBE_KEY=3435tdfsdudebussylmaoxxt43
|
||||
- PUSHER_KEY=3435tdfsdudebussylmaoxxt43
|
||||
- CATBOX_KEY=3435tdfsdudebussylmaoxxt43
|
||||
- SPAM_SIMILARITY_THRESHOLD=0.5
|
||||
- SPAM_SIMILAR_COUNT_THRESHOLD=5
|
||||
- SPAM_URL_SIMILARITY_THRESHOLD=0.1
|
||||
|
|
1
env
1
env
|
@ -11,6 +11,7 @@ export DISCORD_BOT_TOKEN="3435tdfsdudebussylmaoxxt43"
|
|||
export HCAPTCHA_SECRET="3435tdfsdudebussylmaoxxt43"
|
||||
export YOUTUBE_KEY="3435tdfsdudebussylmaoxxt43"
|
||||
export PUSHER_KEY="3435tdfsdudebussylmaoxxt43"
|
||||
export CATBOX_KEY="3435tdfsdudebussylmaoxxt43"
|
||||
export SPAM_SIMILARITY_THRESHOLD="0.5"
|
||||
export SPAM_SIMILAR_COUNT_THRESHOLD="5"
|
||||
export SPAM_URL_SIMILARITY_THRESHOLD="0.1"
|
||||
|
|
|
@ -20,8 +20,8 @@ from files.__main__ import app, limiter, cache, db_session
|
|||
from PIL import Image as PILimage
|
||||
from .front import frontlist, changeloglist
|
||||
|
||||
|
||||
site = environ.get("DOMAIN").strip()
|
||||
CATBOX_KEY = environ.get("CATBOX_KEY").strip()
|
||||
|
||||
with open("snappy.txt", "r") as f: snappyquotes = f.read().split("{[para]}")
|
||||
|
||||
|
@ -809,13 +809,9 @@ def submit_post(v):
|
|||
|
||||
g.db.refresh(new_post)
|
||||
|
||||
# check for uploaded image
|
||||
if request.files.get('file') and request.headers.get("cf-ipcountry") != "T1":
|
||||
|
||||
file = request.files['file']
|
||||
#if not file.content_type.startswith('image/'):
|
||||
# if request.headers.get("Authorization"): return {"error": f"Image files only"}, 400
|
||||
# else: return render_template("submit.html", v=v, error=f"Image files only.", title=title, body=request.values.get("body", "")), 400
|
||||
|
||||
if not file.content_type.startswith(('image/', 'video/')):
|
||||
if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400
|
||||
|
@ -840,10 +836,10 @@ def submit_post(v):
|
|||
file.save(name)
|
||||
new_post.url = process_image(name)
|
||||
|
||||
# elif file.content_type.startswith('video/'):
|
||||
# file.save("video.mp4")
|
||||
# with open("video.mp4", 'rb') as f:
|
||||
# new_post.url = requests.post('https://catbox.moe/user/api.php', data={'userhash':CATBOX_KEY, 'reqtype':'fileupload'}, files={'fileToUpload':f}).text
|
||||
elif file.content_type.startswith('video/'):
|
||||
file.save("video.mp4")
|
||||
with open("video.mp4", 'rb') as f:
|
||||
new_post.url = requests.post('https://catbox.moe/user/api.php', data={'userhash':CATBOX_KEY, 'reqtype':'fileupload'}, files={'fileToUpload':f}).text
|
||||
|
||||
g.db.add(new_post)
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
</div>
|
||||
|
||||
<div id="image-upload-block">
|
||||
<div><label class="mt-3">Image Upload</label></div>
|
||||
<div><label class="mt-3">Attachment Upload</label></div>
|
||||
|
||||
<img loading="lazy" id="image-preview" class="w-100">
|
||||
<label class="btn btn-secondary m-0" for="file-upload">
|
||||
|
@ -81,7 +81,7 @@
|
|||
<input id="file-upload" type="file" name="file" accept="image/*, video/*" hidden>
|
||||
</label>
|
||||
<small class="form-text text-muted">Optional if you have text.</small>
|
||||
<!-- <small class="form-text text-muted">You can upload videos up to 1 minute long.</small> -->
|
||||
<small class="form-text text-muted">You can upload videos up to 1 minute long.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue