diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 1e557ed56..504dd6d39 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -84,9 +84,6 @@ def check_ban_evade(v): g.db.add(ma) except: pass - try: abort(403) - except Exception as e: print(e) - else: v.ban_evade +=1 g.db.add(v) diff --git a/files/routes/awards.py b/files/routes/awards.py index ce2458929..fadb11190 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -227,7 +227,6 @@ def award_post(pid, v): return {"error": "You can't give that award multiple times to the same post."}, 409 post_award.submission_id = post.id - #print(f"give award to pid {post_award.submission_id} ({post.id})") g.db.add(post_award) msg = f"@{v.username} has given your [post]({post.permalink}) the {AWARDS[kind]['title']} Award!" diff --git a/files/routes/discord.py b/files/routes/discord.py index 18bb506f2..c426d3b09 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -30,19 +30,6 @@ def join_discord(v): return redirect(f"https://discord.com/api/oauth2/authorize?client_id={CLIENT_ID}&redirect_uri=https%3A%2F%2F{app.config['SERVER_NAME']}%2Fdiscord_redirect&response_type=code&scope=identify%20guilds.join&state={state}") -@app.get("/sex") -@admin_level_required(6) -def sex(v): - users = g.db.query(User).options(lazyload('*')).filter(User.discord_id != None).all() - headers={ - 'Authorization': f"Bot {BOT_TOKEN}", - 'Content-Type': "application/json" - } - for u in users: - print(u.username) - print(u.discord_id) - print(requests.patch(f"https://discord.com/api/guilds/846509313497628715/members/{u.discord_id}", headers=headers, data={"nick":u.username}).text) - @app.get("/discord_redirect") @auth_required @@ -149,13 +136,9 @@ def discord_redirect(v): else: return x.json() - #check on if they are already there - #print(x.status_code) if x.status_code==204: - ##if user is already a member, remove old roles and update nick - url=f"https://discord.com/api/guilds/{SERVER_ID}/members/{v.discord_id}" data={ "nick": name diff --git a/files/routes/feeds.py b/files/routes/feeds.py index 36af0034c..49cab51bf 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -33,7 +33,6 @@ def feeds_user(sort='hot', t='all'): doc.stag("link", href=request.url_root) for post in posts: - #print("POST IMAGE "+ str( post.is_image )) with tag("entry", ("xml:base", request.url)): with tag("title", type="text"): text(post.title) diff --git a/files/routes/login.py b/files/routes/login.py index c59e4caf5..cd1b9a8e8 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -271,26 +271,21 @@ def sign_up_post(v): return redirect(f"/signup?{urlencode(args)}") if now - int(form_timestamp) < 5: - #print(f"signup fail - {username } - too fast") return new_signup("There was a problem. Please try again.") if not hmac.compare_digest(correct_formkey, form_formkey): - #print(f"signup fail - {username } - mismatched formkeys") return new_signup("There was a problem. Please try again.") - # check for matched passwords if not request.values.get( "password") == request.values.get("password_confirm"): return new_signup("Passwords did not match. Please try again.") - # check username/pass conditions if not re.fullmatch(valid_username_regex, username): return new_signup("Invalid username") if not re.fullmatch(valid_password_regex, request.values.get("password")): return new_signup("Password must be between 8 and 100 characters.") - # Check for existing accounts email = request.values.get("email") email = email.strip() if not email: email = None @@ -301,11 +296,9 @@ def sign_up_post(v): if existing_account or (email and g.db.query( User).filter(User.email.ilike(email)).first()): - # #print(f"signup fail - {username } - email already exists") return new_signup( "An account with that username or email already exists.") - # check bot if app.config.get("HCAPTCHA_SITEKEY"): token = request.values.get("h-captcha-response") if not token: @@ -319,21 +312,16 @@ def sign_up_post(v): x = requests.post(url, data=data) if not x.json()["success"]: - #print(x.json()) return new_signup("Unable to verify captcha [2].") - # kill tokens session.pop("signup_token") - # get referral ref_id = int(request.values.get("referred_by", 0)) - # upgrade user badge if ref_id: ref_user = g.db.query(User).options( lazyload('*')).filter_by(id=ref_id).first() if ref_user: - # check self-setting badges badge_types = g.db.query(BadgeDef).options(lazyload('*')).filter(BadgeDef.qualification_expr.isnot(None)).all() for badge in badge_types: if eval(badge.qualification_expr, {}, {'v': ref_user}): diff --git a/files/routes/posts.py b/files/routes/posts.py index 960806aed..b01bd87a1 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -3,7 +3,7 @@ from urllib.parse import urlparse import mistletoe import urllib.parse import gevent -import traceback +import requests from files.helpers.wrappers import * from files.helpers.sanitize import * diff --git a/files/routes/settings.py b/files/routes/settings.py index 976925209..1fb23e4ce 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -381,7 +381,6 @@ def settings_security_post(v): escape("Passwords do not match.")) if not re.match(valid_password_regex, request.values.get("new_password")): - #print(f"signup fail - {username } - invalid password") return redirect("/settings/security?error=" + escape("Password must be between 8 and 100 characters.")) @@ -791,10 +790,7 @@ def settings_song_change(v): req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails").json() - try: duration = req['items'][0]['contentDetails']['duration'] - except: - print(req) - abort(400) + duration = req['items'][0]['contentDetails']['duration'] if "H" in duration: return render_template("settings_profile.html", v=v,