diff --git a/files/helpers/lottery.py b/files/helpers/lottery.py index fb77a002f..b1d1c09ee 100644 --- a/files/helpers/lottery.py +++ b/files/helpers/lottery.py @@ -33,7 +33,7 @@ def end_lottery_session(): active_lottery = get_active_lottery() if (active_lottery is None): - return False, "There is no active lottery." + return False, "There is no active lottery!" participating_users = get_users_participating_in_lottery() raffle = [] @@ -43,7 +43,7 @@ def end_lottery_session(): if len(raffle) == 0: active_lottery.is_active = False - return True, "Lottery ended with no participants." + return True, "Lottery ended with no participants!" winner = choice(raffle) active_lottery.winner_id = winner @@ -104,13 +104,13 @@ def lottery_ticket_net_value(): def purchase_lottery_tickets(v, quantity=1): if quantity < 1: - return False, f"Must purchase one or more lottershe tickets." + return False, f"Must purchase one or more lottershe tickets!" elif (v.coins < LOTTERY_TICKET_COST * quantity): - return False, f'Lottery tickets cost {LOTTERY_TICKET_COST} coins each.' + return False, f'Lottery tickets cost {LOTTERY_TICKET_COST} coins each!" most_recent_lottery = get_active_lottery() if (most_recent_lottery is None): - return False, "There is no active lottery." + return False, "There is no active lottery!" if not v.charge_account('coins', LOTTERY_TICKET_COST * quantity): return False, "You don't have enough coins" diff --git a/files/helpers/slots.py b/files/helpers/slots.py index 2463a7b2a..069c9daaa 100644 --- a/files/helpers/slots.py +++ b/files/helpers/slots.py @@ -143,7 +143,7 @@ def check_slots_command(c:Comment, v:User, u:User): wager = int(wager) except: if v.id == u.id: - abort(400, "Invalid wager.") + abort(400, "Invalid wager!") return if wager < 100: diff --git a/files/routes/admin.py b/files/routes/admin.py index ab2c1933d..1345b99eb 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -416,7 +416,7 @@ def badge_grant_post(v): user = get_user(request.values.get("username"), graceful=True) if not user: - return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error="User not found.") + return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error="User not found!") try: badge_id = int(request.values.get("badge_id")) except: abort(400) @@ -441,7 +441,7 @@ def badge_grant_post(v): existing.description = description g.db.add(existing) return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, msg="Badge attributes edited successfully!") - return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error="User already has that badge.") + return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=True, error="User already has that badge!") new_badge = Badge( badge_id=badge_id, @@ -477,7 +477,7 @@ def badge_remove_post(v): user = get_user(request.values.get("username"), graceful=True) if not user: - return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error="User not found.") + return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error="User not found!") try: badge_id = int(request.values.get("badge_id")) except: abort(400) @@ -487,7 +487,7 @@ def badge_remove_post(v): badge = user.has_badge(badge_id) if not badge: - return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error="User doesn't have that badge.") + return render_template("admin/badge_admin.html", v=v, badge_types=badges, grant=False, error="User doesn't have that badge!") if v.id != user.id: text = f"@{v.username} (a site admin) has removed the following profile badge from you:\n\n![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}" diff --git a/files/routes/allroutes.py b/files/routes/allroutes.py index cfcc599c1..751750035 100644 --- a/files/routes/allroutes.py +++ b/files/routes/allroutes.py @@ -15,7 +15,7 @@ def before_request(): abort(404) if request.headers.get("CF-Worker"): - abort(403, "Cloudflare workers are not allowed to access this website.") + abort(403, "Cloudflare workers are not allowed to access this website!") g.agent = request.headers.get("User-Agent", "") if not g.agent and request.path != '/kofi': diff --git a/files/routes/asset_submissions.py b/files/routes/asset_submissions.py index 4cad8828c..c99ed204a 100644 --- a/files/routes/asset_submissions.py +++ b/files/routes/asset_submissions.py @@ -50,7 +50,7 @@ def submit_marsey(v:User): return render_template("submit_marseys.html", v=v, marseys=marseys, error=error, name=name, tags=tags, username=username, file=file), 400 if g.is_tor: - return error("Image uploads are not allowed through TOR.") + return error("Image uploads are not allowed through TOR!") if not file or not file.content_type.startswith('image/'): return error("You need to submit an image!") @@ -217,7 +217,7 @@ def submit_hat(v:User): return render_template("submit_hats.html", v=v, hats=hats, error=error, name=name, description=description, username=username), 400 if g.is_tor: - return error("Image uploads are not allowed through TOR.") + return error("Image uploads are not allowed through TOR!") file = request.files["image"] if not file or not file.content_type.startswith('image/'): @@ -369,7 +369,7 @@ def update_marsey(v): if file: if g.is_tor: - return error("Image uploads are not allowed through TOR.") + return error("Image uploads are not allowed through TOR!") if not file.content_type.startswith('image/'): return error("You need to submit an image!") @@ -421,7 +421,7 @@ def update_hat(v): return render_template("update_assets.html", v=v, error=error, type="Hat") if g.is_tor: - return error("Image uploads are not allowed through TOR.") + return error("Image uploads are not allowed through TOR!") if not file or not file.content_type.startswith('image/'): return error("You need to submit an image!") diff --git a/files/routes/awards.py b/files/routes/awards.py index a4a38d571..fbfdd0925 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -51,7 +51,7 @@ def shop(v:User): @auth_required def buy(v:User, award): if award == 'benefactor' and not request.values.get("mb"): - abort(403, "You can only buy the Benefactor award with marseybux.") + abort(403, "You can only buy the Benefactor award with marseybux!") if award == 'ghost' and v.admin_level < PERMS['BUY_GHOST_AWARD']: abort(403, "Only admins can buy this award") @@ -69,15 +69,15 @@ def buy(v:User, award): if request.values.get("mb"): if award == "grass": - abort(403, "You can't buy the grass award with marseybux.") + abort(403, "You can't buy the grass award with marseybux!") charged = v.charge_account('marseybux', price) if not charged: - abort(400, "Not enough marseybux.") + abort(400, "Not enough marseybux!") else: charged = v.charge_account('coins', price) if not charged: - abort(400, "Not enough coins.") + abort(400, "Not enough coins!") v.coins_spent += price if v.coins_spent >= 1000000: @@ -172,10 +172,10 @@ def award_thing(v, thing_type, id): safe_username = f"@{author.username}" if SITE == 'rdrama.net' and author.id in {PIZZASHILL_ID, CARP_ID}: - abort(403, f"{safe_username} is immune to awards.") + abort(403, f"{safe_username} is immune to awards!") if kind == "benefactor" and author.id == v.id: - abort(403, "You can't use this award on yourself.") + abort(403, "You can't use this award on yourself!") if kind == 'marsify' and author.marsify == 1: abort(409, f"{safe_username} is already permanently marsified!") @@ -184,7 +184,7 @@ def award_thing(v, thing_type, id): abort(409, f"{safe_username} already has a permanent spider friend!") if thing.ghost and not AWARDS[kind]['ghost']: - abort(403, "This kind of award can't be used on ghost posts.") + abort(403, "This kind of award can't be used on ghost posts!") if v.id != author.id: if author.deflector and v.deflector and AWARDS[kind]['deflectable']: @@ -283,10 +283,10 @@ def award_thing(v, thing_type, id): abort(403, "You can't give the chud award in /h/chudrama") if author.marseyawarded: - abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award.") + abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award!") if author.agendaposter == 1: - abort(409, f"{safe_username} is perma-chudded.") + abort(409, f"{safe_username} is perma-chudded!") if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400 else: author.agendaposter = int(time.time()) + 86400 @@ -314,13 +314,13 @@ def award_thing(v, thing_type, id): badge_grant(user=author, badge_id=98) elif kind == "pizzashill": if author.bird: - abort(409, f"{safe_username} is under the effect of a conflicting award: Bird Site award.") + abort(409, f"{safe_username} is under the effect of a conflicting award: Bird Site award!") if author.longpost: author.longpost += 86400 else: author.longpost = int(time.time()) + 86400 badge_grant(user=author, badge_id=97) elif kind == "bird": if author.longpost: - abort(409, f"{safe_username} is under the effect of a conflicting award: Pizzashill award.") + abort(409, f"{safe_username} is under the effect of a conflicting award: Pizzashill award!") if author.bird: author.bird += 86400 else: author.bird = int(time.time()) + 86400 badge_grant(user=author, badge_id=95) diff --git a/files/routes/casino.py b/files/routes/casino.py index 3888c91e2..f7a55792b 100644 --- a/files/routes/casino.py +++ b/files/routes/casino.py @@ -90,7 +90,7 @@ def pull_slots(v:User): try: wager = int(request.values.get("wager")) except: - abort(400, "Invalid wager.") + abort(400, "Invalid wager!") try: currency = request.values.get("currency", "").lower() @@ -144,7 +144,7 @@ def blackjack_player_hit(v:User): feed = get_game_feed('blackjack', g.db) return {"success": True, "state": state, "feed": feed, "gambler": {"coins": v.coins, "marseybux": v.marseybux}} except: - abort(400, "Unable to hit.") + abort(400, "Unable to hit!") @app.post("/casino/twentyone/stay") @@ -160,7 +160,7 @@ def blackjack_player_stay(v:User): feed = get_game_feed('blackjack', g.db) return {"success": True, "state": state, "feed": feed, "gambler": {"coins": v.coins, "marseybux": v.marseybux}} except: - abort(400, "Unable to stay.") + abort(400, "Unable to stay!") @app.post("/casino/twentyone/double-down") @@ -176,7 +176,7 @@ def blackjack_player_doubled_down(v:User): feed = get_game_feed('blackjack', g.db) return {"success": True, "state": state, "feed": feed, "gambler": {"coins": v.coins, "marseybux": v.marseybux}} except: - abort(400, "Unable to double down.") + abort(400, "Unable to double down!") @app.post("/casino/twentyone/buy-insurance") @@ -192,7 +192,7 @@ def blackjack_player_bought_insurance(v:User): feed = get_game_feed('blackjack', g.db) return {"success": True, "state": state, "feed": feed, "gambler": {"coins": v.coins, "marseybux": v.marseybux}} except: - abort(403, "Unable to buy insurance.") + abort(403, "Unable to buy insurance!") # Roulette @app.get("/casino/roulette/bets") @@ -238,4 +238,4 @@ def roulette_player_placed_bet(v:User): bets = get_roulette_bets() return {"success": True, "bets": bets, "gambler": {"coins": v.coins, "marseybux": v.marseybux}} except: - abort(400, "Unable to place a bet.") + abort(400, "Unable to place a bet!") diff --git a/files/routes/chat.py b/files/routes/chat.py index 02aac2ec6..178557275 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -37,7 +37,7 @@ messages = cache.get(f'messages') or { @admin_level_required(PERMS['CHAT']) def chat(v): if not v.admin_level and TRUESCORE_CHAT_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM: - abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat.") + abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat!") return render_template("chat.html", v=v, messages=messages[f"{SITE_FULL}/chat"]) @app.get("/admin/chat") diff --git a/files/routes/comments.py b/files/routes/comments.py index 7957125b1..b20d8ce8a 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -50,7 +50,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): post = get_post(post, v=v) if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()): - if v and v.client: abort(403, "This content is not suitable for some users and situations.") + if v and v.client: abort(403, "This content is not suitable for some users and situations!") else: return render_template("errors/nsfw.html", v=v), 403 try: context = min(int(request.values.get("context", 8)), 8) @@ -87,7 +87,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): @limiter.limit("1/second;20/minute;200/hour;1000/day", key_func=get_ID) @auth_required def comment(v:User): - if v.is_suspended: abort(403, "You can't perform this action while banned.") + if v.is_suspended: abort(403, "You can't perform this action while banned!") parent_fullname = request.values.get("parent_fullname").strip() if len(parent_fullname) < 3: abort(400) @@ -147,7 +147,7 @@ def comment(v:User): if not body and not request.files.get('file'): abort(400, "You need to actually write something!") if not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and parent_user.any_block_exists(v): - abort(403, "You can't reply to users who have blocked you or users that you have blocked.") + abort(403, "You can't reply to users who have blocked you or users that you have blocked!") body, _, options, choices = sanitize_poll_options(v, body, False) diff --git a/files/routes/hats.py b/files/routes/hats.py index 106701a21..ad79f7e1b 100644 --- a/files/routes/hats.py +++ b/files/routes/hats.py @@ -42,17 +42,17 @@ def buy_hat(v:User, hat_id): if existing: abort(409, "You already own this hat!") if not hat.is_purchasable: - abort(403, "This hat is not for sale.") + abort(403, "This hat is not for sale!") if request.values.get("mb"): charged = v.charge_account('marseybux', hat.price) - if not charged: abort(400, "Not enough marseybux.") + if not charged: abort(400, "Not enough marseybux!") hat.author.pay_account('marseybux', hat.price * 0.1) currency = "marseybux" else: charged = v.charge_account('coins', hat.price) - if not charged: abort(400, "Not enough coins.") + if not charged: abort(400, "Not enough coins!") v.coins_spent_on_hats += hat.price hat.author.pay_account('coins', hat.price * 0.1) diff --git a/files/routes/login.py b/files/routes/login.py index df50acbb8..4265d0db6 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -149,7 +149,7 @@ def logout(v): @auth_desired def sign_up_get(v:Optional[User]): if not get_setting('signups'): - abort(403, "New account registration is currently closed. Please come back later.") + abort(403, "New account registration is currently closed. Please come back later!") if v: return redirect(SITE_FULL) ref = request.values.get("ref") @@ -197,7 +197,7 @@ def sign_up_get(v:Optional[User]): @auth_desired def sign_up_post(v:Optional[User]): if not get_setting('signups'): - abort(403, "New account registration is currently closed. Please come back later.") + abort(403, "New account registration is currently closed. Please come back later!") if v: abort(403) @@ -247,7 +247,7 @@ def sign_up_post(v:Optional[User]): submitted_token = session.get("signup_token", "") if not submitted_token: session.clear() - return signup_error(f"An error occurred while attempting to signup. If you get this repeatedly, please make sure cookies are enabled.") + return signup_error(f"An error occurred while attempting to signup. If you get this repeatedly, please make sure cookies are enabled!") correct_formkey_hashstr = form_timestamp + submitted_token + g.agent correct_formkey = hmac.new(key=bytes(SECRET_KEY, "utf-16"), @@ -258,30 +258,30 @@ def sign_up_post(v:Optional[User]): now = int(time.time()) if now - int(form_timestamp) < 5: - return signup_error("There was a problem. Please try again.") + return signup_error("There was a problem. Please try again!") if not hmac.compare_digest(correct_formkey, form_formkey): if IS_LOCALHOST: return signup_error("There was a problem. Please try again!") - return signup_error("There was a problem. Please try again.") + return signup_error("There was a problem. Please try again!") if not request.values.get( "password") == request.values.get("password_confirm"): - return signup_error("Passwords did not match. Please try again.") + return signup_error("Passwords did not match. Please try again!") if not valid_username_regex.fullmatch(username): return signup_error("Invalid username") if not valid_password_regex.fullmatch(request.values.get("password")): - return signup_error("Password must be between 8 and 100 characters.") + return signup_error("Password must be between 8 and 100 characters!") if email: if not email_regex.fullmatch(email): - return signup_error("Invalid email.") + return signup_error("Invalid email!") else: email = None existing_account = get_user(username, graceful=True) if existing_account: - return signup_error("An account with that username already exists.") + return signup_error("An account with that username already exists!") if TURNSTILE_SITEKEY != DEFAULT_CONFIG_VALUE: token = request.values.get("cf-turnstile-response") @@ -374,7 +374,7 @@ def post_forgot(): email = request.values.get("email",'').strip().lower() if not email_regex.fullmatch(email): - return render_template("login/forgot_password.html", error="Invalid email."), 400 + return render_template("login/forgot_password.html", error="Invalid email!"), 400 username = username.lstrip('@').replace('\\', '').replace('_', '\_').replace('%', '').strip() @@ -412,7 +412,7 @@ def get_reset(): now = int(time.time()) if now - timestamp > 600: - abort(410, "This password reset link has expired.") + abort(410, "This password reset link has expired!") user = get_account(user_id) @@ -446,7 +446,7 @@ def post_reset(v:Optional[User]): now = int(time.time()) if now - timestamp > 600: - abort(410, "This password reset link has expired.") + abort(410, "This password reset link has expired!") user = get_account(user_id) if not validate_hash(f"{user_id}+{timestamp}+reset+{user.login_nonce}", token): @@ -522,7 +522,7 @@ def reset_2fa(): abort(400) if now > t+3600*24: - abort(410, "This 2FA reset link has expired.") + abort(410, "This 2FA reset link has expired!") token=request.values.get("token") uid=request.values.get("id") diff --git a/files/routes/lottery.py b/files/routes/lottery.py index c53bb7edc..ba8790867 100644 --- a/files/routes/lottery.py +++ b/files/routes/lottery.py @@ -19,7 +19,7 @@ def lottery_end(v): @admin_level_required(PERMS['LOTTERY_ADMIN']) def lottery_start(v): start_new_lottery_session() - return {"message": "Lottery started."} + return {"message": "Lottery started!"} @app.post("/lottery/buy") @@ -28,7 +28,7 @@ def lottery_start(v): @auth_required def lottery_buy(v:User): try: quantity = int(request.values.get("quantity")) - except: abort(400, "Invalid ticket quantity.") + except: abort(400, "Invalid ticket quantity!") success, message = purchase_lottery_tickets(v, quantity) lottery, participants = get_active_lottery_stats() diff --git a/files/routes/mail.py b/files/routes/mail.py index 891a26fa4..ca3b761e9 100644 --- a/files/routes/mail.py +++ b/files/routes/mail.py @@ -14,7 +14,7 @@ from files.__main__ import app, limiter @auth_required def verify_email(v): send_verification_email(v) - return {"message": "Email has been sent. Check your spam folder if you can't find it."} + return {"message": "Email has been sent. Check your spam folder if you can't find it!"} @app.get("/activate") @@ -31,7 +31,7 @@ def activate(v:User): token = request.values.get("token", "").strip() if int(time.time()) - timestamp > 3600: - abort(410, "This email verification link has expired. Visit your settings to send yourself a new one.") + abort(410, "This email verification link has expired. Visit your settings to send yourself a new one!") user = get_account(id) @@ -48,4 +48,4 @@ def activate(v:User): g.db.add(user) - return render_template("message_success.html", v=v, title="Email verified.", message=f"Your email {email} has been verified. Thank you.") + return render_template("message_success.html", v=v, title="Email verified!", message=f"Your email {email} has been verified. Thank you!") diff --git a/files/routes/posts.py b/files/routes/posts.py index 8f0c823d8..dc46ea567 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -275,7 +275,7 @@ def edit_post(pid, v): abort(403, "You have to type less than 140 characters!") if not title: - abort(400, "Please enter a better title.") + abort(400, "Please enter a better title!") if title != p.title: torture = (v.agendaposter and not v.marseyawarded and p.sub != 'chudrama' and v.id == p.author_id) @@ -538,7 +538,7 @@ def submit_post(v:User, sub=None): return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body), 400 if not title: - return error("Please enter a better title.") + return error("Please enter a better title!") sub = request.values.get("sub", "").lower().replace('/h/','').strip() @@ -572,7 +572,7 @@ def submit_post(v:User, sub=None): if not sub and HOLE_REQUIRED: return error(f"You must choose a {HOLE_NAME} for your post!") - if v.is_suspended: return error("You can't perform this action while banned.") + if v.is_suspended: return error("You can't perform this action while banned!") if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')): return error("You have to type more than 280 characters!") @@ -639,7 +639,7 @@ def submit_post(v:User, sub=None): if not url and not body and not request.files.get("file") and not request.files.get("file-url"): - return error("Please enter a url or some text.") + return error("Please enter a url or some text!") if not IS_LOCALHOST: dup = g.db.query(Submission).filter( @@ -655,7 +655,7 @@ def submit_post(v:User, sub=None): return redirect("/notifications") if len(url) > 2048: - return error("There's a 2048 character limit for URLs.") + return error("There's a 2048 character limit for URLs!") body, bets, options, choices = sanitize_poll_options(v, body, True) diff --git a/files/routes/reporting.py b/files/routes/reporting.py index 365a7a9d8..21c2d4d5c 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -20,7 +20,7 @@ def flag_post(pid, v): reason = request.values.get("reason", "").strip() execute_under_siege(v, post, reason, 'flag') execute_blackjack(v, post, reason, 'flag') - if v.is_muted: abort(403, "You are forbidden from making reports.") + if v.is_muted: abort(403, "You are forbidden from making reports!") reason = reason[:100] og_flair = reason[1:] reason = filter_emojis_only(reason) @@ -84,7 +84,7 @@ def flag_comment(cid, v): reason = reason[:100] reason = filter_emojis_only(reason) - if len(reason) > 350: abort(400, "Too long.") + if len(reason) > 350: abort(400, "Too long!") flag = CommentFlag(comment_id=comment.id, user_id=v.id, reason=reason) diff --git a/files/routes/search.py b/files/routes/search.py index 1be178f14..591127558 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -206,7 +206,7 @@ def searchcomments(v:User): if v.client: abort(403, f"@{author.username}'s profile is private; You can't use the 'author' syntax on them") - return render_template("search_comments.html", v=v, query=query, total=0, page=page, comments=[], sort=sort, t=t, next_exists=False, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them."), 403 + return render_template("search_comments.html", v=v, query=query, total=0, page=page, comments=[], sort=sort, t=t, next_exists=False, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them!"), 403 else: comments = comments.filter(Comment.author_id == author.id) diff --git a/files/routes/settings.py b/files/routes/settings.py index 84feecfda..13801d084 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -53,7 +53,7 @@ def remove_background(v): @limiter.limit(DEFAULT_RATELIMIT_SLOWER, key_func=get_ID) @auth_required def upload_custom_background(v): - if g.is_tor: abort(403, "Image uploads are not allowed through TOR.") + if g.is_tor: abort(403, "Image uploads are not allowed through TOR!") if not v.patron: abort(403, f"This feature is only available to {patron}s!") @@ -77,7 +77,7 @@ def upload_custom_background(v): @limiter.limit(DEFAULT_RATELIMIT_SLOWER, key_func=get_ID) @auth_required def upload_profile_background(v): - if g.is_tor: abort(403, "Image uploads are not allowed through TOR.") + if g.is_tor: abort(403, "Image uploads are not allowed through TOR!") file = request.files["file"] @@ -205,25 +205,25 @@ def settings_personal_post(v): v.bio = None v.bio_html = None g.db.add(v) - return render_template("settings/personal.html", v=v, msg="Your bio has been updated.") + return render_template("settings/personal.html", v=v, msg="Your bio has been updated!") elif not updated and request.values.get("sig") == "": v.sig = None v.sig_html = None g.db.add(v) - return render_template("settings/personal.html", v=v, msg="Your sig has been updated.") + return render_template("settings/personal.html", v=v, msg="Your sig has been updated!") elif not updated and request.values.get("friends") == "": v.friends = None v.friends_html = None g.db.add(v) - return render_template("settings/personal.html", v=v, msg="Your friends list has been updated.") + return render_template("settings/personal.html", v=v, msg="Your friends list has been updated!") elif not updated and request.values.get("enemies") == "": v.enemies = None v.enemies_html = None g.db.add(v) - return render_template("settings/personal.html", v=v, msg="Your enemies list has been updated.") + return render_template("settings/personal.html", v=v, msg="Your enemies list has been updated!") elif not updated and v.patron and request.values.get("sig"): sig = request.values.get("sig")[:200].replace('\n','').replace('\r','') @@ -354,9 +354,9 @@ def settings_personal_post(v): if updated: g.db.add(v) - return {"message": "Your settings have been updated."} + return {"message": "Your settings have been updated!"} else: - abort(400, "You didn't change anything.") + abort(400, "You didn't change anything!") @app.post("/settings/filters") @@ -370,7 +370,7 @@ def filters(v:User): v.custom_filter_list=filters g.db.add(v) - return redirect("/settings/advanced?msg=Your custom filters have been updated.") + return redirect("/settings/advanced?msg=Your custom filters have been updated!") def set_color(v:User, attr:str, color:Optional[str]): @@ -459,10 +459,10 @@ def verifiedcolor(v): def settings_security_post(v): if request.values.get("new_password"): if request.values.get("new_password") != request.values.get("cnf_password"): - return render_template("settings/security.html", v=v, error="Passwords do not match.") + return render_template("settings/security.html", v=v, error="Passwords do not match!") if not valid_password_regex.fullmatch(request.values.get("new_password")): - return render_template("settings/security.html", v=v, error="Password must be between 8 and 100 characters.") + return render_template("settings/security.html", v=v, error="Password must be between 8 and 100 characters!") if not v.verifyPass(request.values.get("old_password")): return render_template("settings/security.html", v=v, error="Incorrect password") @@ -470,11 +470,11 @@ def settings_security_post(v): v.passhash = hash_password(request.values.get("new_password")) g.db.add(v) - return render_template("settings/security.html", v=v, msg="Your password has been changed.") + return render_template("settings/security.html", v=v, msg="Your password has been changed!") if request.values.get("new_email"): if not v.verifyPass(request.values.get('password')): - return render_template("settings/security.html", v=v, error="Invalid password.") + return render_template("settings/security.html", v=v, error="Invalid password!") new_email = request.values.get("new_email","").strip().lower() @@ -497,34 +497,34 @@ def settings_security_post(v): v=v) ) - return render_template("settings/security.html", v=v, msg="We have sent you an email, click the verification link inside it to complete the email change. Check your spam folder if you can't find it.") + return render_template("settings/security.html", v=v, msg="We have sent you an email, click the verification link inside it to complete the email change. Check your spam folder if you can't find it!") if request.values.get("2fa_token"): if not v.verifyPass(request.values.get('password')): - return render_template("settings/security.html", v=v, error="Invalid password.") + return render_template("settings/security.html", v=v, error="Invalid password!") secret = request.values.get("2fa_secret") x = pyotp.TOTP(secret) if not x.verify(request.values.get("2fa_token"), valid_window=1): - return render_template("settings/security.html", v=v, error="Invalid token.") + return render_template("settings/security.html", v=v, error="Invalid token!") v.mfa_secret = secret g.db.add(v) - return render_template("settings/security.html", v=v, msg="Two-factor authentication enabled.") + return render_template("settings/security.html", v=v, msg="Two-factor authentication enabled!") if request.values.get("2fa_remove"): if not v.verifyPass(request.values.get('password')): - return render_template("settings/security.html", v=v, error="Invalid password.") + return render_template("settings/security.html", v=v, error="Invalid password!") token = request.values.get("2fa_remove") if not token or not v.validate_2fa(token): - return render_template("settings/security.html", v=v, error="Invalid token.") + return render_template("settings/security.html", v=v, error="Invalid token!") v.mfa_secret = None g.db.add(v) g.db.commit() - return render_template("settings/security.html", v=v, msg="Two-factor authentication disabled.") + return render_template("settings/security.html", v=v, msg="Two-factor authentication disabled!") @app.post("/settings/log_out_all_others") @limiter.limit(DEFAULT_RATELIMIT_SLOWER) @@ -547,7 +547,7 @@ def settings_log_out_others(v): @limiter.limit(DEFAULT_RATELIMIT_SLOWER, key_func=get_ID) @auth_required def settings_images_profile(v): - if g.is_tor: abort(403, "Image uploads are not allowed through TOR.") + if g.is_tor: abort(403, "Image uploads are not allowed through TOR!") file = request.files["profile"] @@ -585,7 +585,7 @@ def settings_images_profile(v): @limiter.limit(DEFAULT_RATELIMIT_SLOWER, key_func=get_ID) @auth_required def settings_images_banner(v): - if g.is_tor: abort(403, "Image uploads are not allowed through TOR.") + if g.is_tor: abort(403, "Image uploads are not allowed through TOR!") file = request.files["banner"] @@ -650,7 +650,7 @@ def settings_security(v:User): @auth_required def settings_block_user(v): user = get_user(request.values.get("username"), graceful=True) - if not user: abort(404, "This user doesn't exist.") + if not user: abort(404, "This user doesn't exist!") if user.unblockable: if not v.shadowbanned: @@ -668,7 +668,7 @@ def settings_block_user(v): send_notification(user.id, f"@{v.username} has blocked you!") cache.delete_memoized(frontlist) - return {"message": f"@{user.username} blocked."} + return {"message": f"@{user.username} blocked!"} @app.post("/settings/unblock") diff --git a/files/routes/subs.py b/files/routes/subs.py index cc28591d8..5eec21515 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -555,7 +555,7 @@ def delete_all_sub_banners(v:User, sub:str): @limiter.limit("1/second;10/day", key_func=get_ID) @is_not_permabanned def sub_sidebar(v:User, sub): - if g.is_tor: abort(403, "Image uploads are not allowed through TOR.") + if g.is_tor: abort(403, "Image uploads are not allowed through TOR!") sub = get_sub_by_name(sub) if not v.mods(sub.name): abort(403) @@ -586,7 +586,7 @@ def sub_sidebar(v:User, sub): @limiter.limit("1/second;10/day", key_func=get_ID) @is_not_permabanned def sub_marsey(v:User, sub): - if g.is_tor: abort(403, "Image uploads are not allowed through TOR.") + if g.is_tor: abort(403, "Image uploads are not allowed through TOR!") sub = get_sub_by_name(sub) if not v.mods(sub.name): abort(403) diff --git a/files/routes/users.py b/files/routes/users.py index e26a1af34..6b3eb2773 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -489,7 +489,7 @@ def message2(v:User, username:str): abort(403, f"You're blocking @{user.username}") if v.admin_level <= PERMS['MESSAGE_BLOCKED_USERS'] and hasattr(user, 'is_blocked') and user.is_blocked: - abort(403, f"@{user.username} is blocking you.") + abort(403, f"@{user.username} is blocking you!") message = sanitize_raw_body(request.values.get("message"), False) @@ -505,7 +505,7 @@ def message2(v:User, username:str): Comment.body_html == body_html ).first() - if existing: abort(403, "Message already exists.") + if existing: abort(403, "Message already exists!") c = Comment(author_id=v.id, parent_submission=None, @@ -551,9 +551,9 @@ def messagereply(v:User): user_id = parent.author.id if v.is_suspended_permanently and parent.sentto != MODMAIL_ID: - abort(403, "You are permabanned and may not reply to messages.") + abort(403, "You are permabanned and may not reply to messages!") elif v.is_muted and parent.sentto == MODMAIL_ID: - abort(403, "You are forbidden from replying to modmail.") + abort(403, "You are forbidden from replying to modmail!") if parent.sentto == MODMAIL_ID: user_id = None elif v.id == user_id: user_id = parent.sentto @@ -1028,7 +1028,7 @@ def u_username_info(username, v=None): if hasattr(user, 'is_blocking') and user.is_blocking: abort(401, f"You're blocking @{user.username}") elif hasattr(user, 'is_blocked') and user.is_blocked: - abort(403, f"@{user.username} is blocking you.") + abort(403, f"@{user.username} is blocking you!") return user.json @@ -1042,7 +1042,7 @@ def u_user_id_info(id, v=None): if hasattr(user, 'is_blocking') and user.is_blocking: abort(403, f"You're blocking @{user.username}") elif hasattr(user, 'is_blocked') and user.is_blocked: - abort(403, f"@{user.username} is blocking you.") + abort(403, f"@{user.username} is blocking you!") return user.json