From eb25c628c89ea16e5b779c31c31c12bfcf69f865 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 28 Dec 2021 06:47:02 +0200 Subject: [PATCH] fdsfd --- .github/FUNDING.yml | 2 +- docker-compose.yml | 3 ++- env | 3 ++- files/routes/admin.py | 4 +++- files/routes/comments.py | 6 +++--- files/routes/posts.py | 8 ++++---- files/routes/settings.py | 7 ++++--- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1d7bc6b62..0612d9440 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ github: Aevann1 -custom: ["https://marsey1.gumroad.com/l/tfcvri"] +custom: ["https://marsey1.gumroad.com/l/tfcvri"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1f3e9ea1d..6c2f0d13f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ services: - HCAPTCHA_SECRET=3435tdfsdudebussylmaoxxt43 - YOUTUBE_KEY=3435tdfsdudebussylmaoxxt43 - PUSHER_KEY=3435tdfsdudebussylmaoxxt43 - - CATBOX_KEY=3435tdfsdudebussylmaoxxt43 + - IMGUR_KEY=3435tdfsdudebussylmaoxxt43 - SPAM_SIMILARITY_THRESHOLD=0.5 - SPAM_SIMILAR_COUNT_THRESHOLD=5 - SPAM_URL_SIMILARITY_THRESHOLD=0.1 @@ -36,6 +36,7 @@ services: - SLOGAN=Dude bussy lmao - GUMROAD_TOKEN=3435tdfsdudebussylmaoxxt43 - GUMROAD_LINK=https://marsey1.gumroad.com/l/tfcvri + - GUMROAD_ID=tfcvri - CARD_VIEW=1 - DISABLE_DOWNVOTES=0 - DUES=0 diff --git a/env b/env index b62a3e91d..c30a997f7 100644 --- a/env +++ b/env @@ -10,7 +10,7 @@ export DISCORD_BOT_TOKEN="3435tdfsdudebussylmaoxxt43" export HCAPTCHA_SECRET="3435tdfsdudebussylmaoxxt43" export YOUTUBE_KEY="3435tdfsdudebussylmaoxxt43" export PUSHER_KEY="3435tdfsdudebussylmaoxxt43" -export CATBOX_KEY="3435tdfsdudebussylmaoxxt43" +export IMGUR_KEY="3435tdfsdudebussylmaoxxt43" export SPAM_SIMILARITY_THRESHOLD="0.5" export SPAM_SIMILAR_COUNT_THRESHOLD="5" export SPAM_URL_SIMILARITY_THRESHOLD="0.1" @@ -23,6 +23,7 @@ export DEFAULT_TIME_FILTER="all" export SLOGAN="Dude bussy lmao" export GUMROAD_TOKEN="3435tdfsdudebussylmaoxxt43" export GUMROAD_LINK="https://marsey1.gumroad.com/l/tfcvri" +export GUMROAD_ID="tfcvri" export CARD_VIEW="1" export DISABLE_DOWNVOTES="0" export DUES="0" diff --git a/files/routes/admin.py b/files/routes/admin.py index 36e53fa68..5f3376115 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -19,6 +19,8 @@ from files.helpers.discord import add_role from datetime import datetime SITE_NAME = environ.get("SITE_NAME", "").strip() +GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() + if SITE_NAME == 'PCM': cc = "splash mountain" else: cc = "country club" month = datetime.now().strftime('%B') @@ -201,7 +203,7 @@ def monthly(v): data = {'access_token': GUMROAD_TOKEN} - response = [x['email'] for x in requests.get('https://api.gumroad.com/v2/products/tfcvri/subscribers', data=data, timeout=5).json()["subscribers"]] + response = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]] emails = [] for email in response: diff --git a/files/routes/comments.py b/files/routes/comments.py index 533edff1a..993952f77 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -14,7 +14,7 @@ import requests site = environ.get("DOMAIN").strip() if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" else: cc = "COUNTRY CLUB" -CATBOX_KEY = environ.get("CATBOX_KEY").strip() +IMGUR_KEY = environ.get("IMGUR_KEY").strip() beams_client = PushNotifications( instance_id=PUSHER_INSTANCE_ID, @@ -202,7 +202,7 @@ def api_comment(v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link'] body += f"\n\n{url}" else: return {"error": f"Image/Video files only"}, 400 @@ -716,7 +716,7 @@ def edit_comment(cid, v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link'] body += f"\n\n{url}" else: return {"error": f"Image/Video files only"}, 400 diff --git a/files/routes/posts.py b/files/routes/posts.py index c437f1bf0..5f420f62d 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -22,7 +22,7 @@ from shutil import copyfile site = environ.get("DOMAIN").strip() site_name = environ.get("SITE_NAME").strip() -CATBOX_KEY = environ.get("CATBOX_KEY").strip() +IMGUR_KEY = environ.get("IMGUR_KEY").strip() titleheaders = {"User-Agent": f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"} if path.exists(f'snappy_{site_name}.txt'): @@ -449,7 +449,7 @@ def edit_post(pid, v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link'] body += f"\n\n{url}" else: return {"error": f"Image/Video files only"}, 400 @@ -941,7 +941,7 @@ def submit_post(v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link'] body += f"\n\n{url}" else: if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 @@ -1043,7 +1043,7 @@ def submit_post(v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link'] new_post.url = url if not new_post.thumburl and new_post.url and request.headers.get('cf-ipcountry')!="T1": gevent.spawn( thumbnail_thread, new_post.id) diff --git a/files/routes/settings.py b/files/routes/settings.py index 49616b555..692082909 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -22,7 +22,8 @@ YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip() COINS_NAME = environ.get("COINS_NAME").strip() GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() SITE_NAME = environ.get("SITE_NAME", "").strip() -CATBOX_KEY = environ.get("CATBOX_KEY").strip() +IMGUR_KEY = environ.get("IMGUR_KEY").strip() +GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() tiers={ "(Paypig)": 1, @@ -302,7 +303,7 @@ def settings_profile_post(v): elif file.content_type.startswith('video/'): file.save("video.mp4") with open("video.mp4", 'rb') as f: - url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {CATBOX_KEY}'}, files=[('video', f)]).json()['data']['link'] + url = requests.request("POST", "https://api.imgur.com/3/upload", headers={'Authorization': f'Client-ID {IMGUR_KEY}'}, files=[('video', f)]).json()['data']['link'] bio += f"\n\n{url}" else: if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 @@ -501,7 +502,7 @@ def gumroad(v): data = {'access_token': GUMROAD_TOKEN,} - response = [x['email'] for x in requests.get('https://api.gumroad.com/v2/products/tfcvri/subscribers', data=data, timeout=5).json()["subscribers"]] + response = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]] emails = [] for email in response: