diff --git a/docker-compose.yml b/docker-compose.yml
index 638dc9edf6..f6589b894a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -20,8 +20,7 @@ services:
- DISCORD_CLIENT_ID=3435tdfsdudebussylmaoxxt43
- DISCORD_CLIENT_SECRET=3435tdfsdudebussylmaoxxt43
- DISCORD_BOT_TOKEN=3435tdfsdudebussylmaoxxt43
- - IMGUR_KEY=3435tdfsdudebussylmaoxxt43
- - IBB_KEY=3435tdfsdudebussylmaoxxt43
+ - CATBOX_KEY=3435tdfsdudebussylmaoxxt43
#- HCAPTCHA_SITEKEY=3435tdfsdudebussylmaoxxt43
- HCAPTCHA_SECRET=3435tdfsdudebussylmaoxxt43
- YOUTUBE_KEY=3435tdfsdudebussylmaoxxt43
diff --git a/env b/env
index 6ed13b61cc..732244adc4 100644
--- a/env
+++ b/env
@@ -10,8 +10,7 @@ export DISCORD_SERVER_ID="3435tdfsdudebussylmaoxxt43"
export DISCORD_CLIENT_ID="3435tdfsdudebussylmaoxxt43"
export DISCORD_CLIENT_SECRET="3435tdfsdudebussylmaoxxt43"
export DISCORD_BOT_TOKEN="3435tdfsdudebussylmaoxxt43"
-export IMGUR_KEY="3435tdfsdudebussylmaoxxt43"
-export IBB_KEY="3435tdfsdudebussylmaoxxt43"
+export CATBOX_KEY="3435tdfsdudebussylmaoxxt43"
export HCAPTCHA_SECRET="3435tdfsdudebussylmaoxxt43"
export YOUTUBE_KEY="3435tdfsdudebussylmaoxxt43"
export PUSHER_KEY="3435tdfsdudebussylmaoxxt43"
diff --git a/files/classes/submission.py b/files/classes/submission.py
index f64cd01fe8..67f6b34399 100644
--- a/files/classes/submission.py
+++ b/files/classes/submission.py
@@ -26,7 +26,6 @@ class Submission(Base):
is_banned = Column(Boolean, default=False)
removed_by = Column(Integer)
bannedfor = Column(Boolean)
- processing = Column(Boolean, default=False)
views = Column(Integer, default=0)
deleted_utc = Column(Integer, default=0)
distinguish_level = Column(Integer, default=0)
diff --git a/files/helpers/images.py b/files/helpers/images.py
index 664013e69a..230a3637ee 100644
--- a/files/helpers/images.py
+++ b/files/helpers/images.py
@@ -6,8 +6,6 @@ from flask import g
from werkzeug.utils import secure_filename
from webptools import gifwebp
-IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
-IBB_KEY = environ.get("IBB_KEY", "").strip()
CATBOX_KEY = environ.get("CATBOX_KEY", "").strip()
def upload_ibb(file=None, resize=False):
@@ -49,26 +47,9 @@ class UploadException(Exception):
def upload_video(file):
- file_path = path.join("temp", secure_filename(file.filename))
- file.save(file_path)
+ file.save("video.mp4")
- headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}
- with open(file_path, 'rb') as f:
- try:
- r = requests.post('https://api.imgur.com/3/upload', headers=headers, files={"video": f})
+ with open("video.mp4", 'rb') as f:
+ req = requests.post('https://catbox.moe/user/api.php', data={'userhash':CATBOX_KEY, 'reqtype':'fileupload'}, files={'fileToUpload':f})
- r.raise_for_status()
-
- resp = r.json()['data']
- except requests.HTTPError as e:
- raise UploadException("Invalid video. Make sure it's 1 minute long or shorter.")
- except:
- raise UploadException("Error, please try again later.")
- finally:
- remove(file_path)
-
- link = resp['link']
- img = Image(text=link, deletehash=resp['deletehash'])
- g.db.add(img)
-
- return link
\ No newline at end of file
+ return req.text
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 875574b58d..7659972868 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -18,7 +18,6 @@ from files.__main__ import app, cache, limiter
from .front import frontlist
from files.helpers.discord import add_role
-IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
SITE_NAME = environ.get("SITE_NAME", "").strip()
diff --git a/files/routes/front.py b/files/routes/front.py
index ec02b0ba0c..5766ba1095 100644
--- a/files/routes/front.py
+++ b/files/routes/front.py
@@ -169,11 +169,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
posts = posts.filter_by(is_banned=False, stickied=None, private=False, deleted_utc = 0)
- if v:
- posts = posts.filter(or_(Submission.processing == False, Submission.author_id == v.id))
- else:
- posts = posts.filter_by(processing=False)
-
if v and v.admin_level == 0:
blocking = [x[0] for x in g.db.query(
UserBlock.target_id).filter_by(
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 16101e55c4..91d515f46a 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -384,43 +384,6 @@ def filter_title(title):
return title
-IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
-
-
-def check_processing_thread(v, post, link):
-
- image_id = link.split('/')[-1].rstrip('.mp4')
- headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}
-
- while True:
- # break on error to prevent zombie threads
- try:
- time.sleep(15)
-
- req = requests.get(f"https://api.imgur.com/3/image/{image_id}", headers=headers)
-
- status = req.json()['data']['processing']['status']
- if status == 'completed':
- post.processing = False
- g.db.add(post)
-
- send_notification(
- NOTIFICATIONS_ACCOUNT,
- v,
- f"Your video has finished processing and your [post](/post/{post.id}) is now live."
- )
-
- g.db.commit()
- break
- # just in case
- elif status == 'failed':
- print(f"video upload for post {post.id} failed")
- break
- except Exception as e:
- traceback.print_exc()
- print("retard. aborting thread")
- break
-
def thumbnail_thread(pid):
@@ -870,29 +833,8 @@ def submit_post(v):
body=request.values.get("body", "")
), 403
- if file.content_type.startswith('image/'):
- new_post.url = upload_ibb(file=file)
- else:
- try:
- post_url = upload_video(file)
- if not post_url.endswith('.mp4'):
- post_url += 'mp4'
- new_post.url = post_url
- new_post.processing = True
- gevent.spawn(check_processing_thread, v.id, new_post, post_url)
- except UploadException as e:
- if request.headers.get("Authorization"):
- return {
- "error": str(e),
- }, 400
- else:
- return render_template(
- "submit.html",
- v=v,
- error=str(e),
- title=title,
- body=request.values.get("body", "")
- ), 400
+ if file.content_type.startswith('image/'): new_post.url = upload_ibb(file=file)
+ elif file.content_type.startswith('video/'): new_post.post_url = upload_video(file)
g.db.add(new_post)
diff --git a/files/templates/submission.html b/files/templates/submission.html
index d7c6526f02..336f59110e 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -267,7 +267,6 @@
{% if p.is_bot %} {% endif %}
{% if p.over_18 %}{% endif %}
{% if p.private %}{% endif %}
- {% if p.processing %}{% endif %}
{% if p.active_flags %}{{p.active_flags}} Reports{% endif %}
{% if p.author.verified %}
{% endif %}
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index 0466e6403b..9452c6e99c 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -137,7 +137,6 @@
{% if p.is_blocking %}{% endif %}
{% if p.is_blocked %}{% endif %}
{% if p.private %}{% endif %}
- {% if p.processing %}{% endif %}
{% if p.active_flags %}{{p.active_flags}} Reports{% endif %}
{% if p.author.verified %}
{% endif %}