From 4602e374eeaee91ffebab01fef4715dcb8574139 Mon Sep 17 00:00:00 2001 From: G-tix Date: Thu, 10 Aug 2023 12:37:57 +0000 Subject: [PATCH] Remove unnecessary redirects and remove temp event stuff. (#183) Removing 400 redirects as this confuses users (including me lol). Also removed some event stuff which seems redundant. Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/183 Co-authored-by: G-tix Co-committed-by: G-tix --- files/routes/posts.py | 3 --- files/routes/settings.py | 16 ++++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 3b5554acf..81aaf2867 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -692,9 +692,6 @@ def delete_post_pid(pid, v): p = get_post(pid) if p.author_id != v.id: abort(403) - # Temporary special logic by Carp request for events of 2022-10-10 - if SITE_NAME == 'rDrama' and p.author_id == 3161: abort(403) - if not p.deleted_utc: p.deleted_utc = int(time.time()) p.is_pinned = False diff --git a/files/routes/settings.py b/files/routes/settings.py index 3d782e48e..2a1cd5ed8 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -869,13 +869,13 @@ def settings_song_change(v): elif song.startswith("https://youtu.be/"): id = song.split("https://youtu.be/")[1] else: - return redirect("/settings/personal?error=Not a YouTube link!"), 400 + return redirect("/settings/personal?error=Not a YouTube link!") if "?" in id: id = id.split("?")[0] if "&" in id: id = id.split("&")[0] if not yt_id_regex.fullmatch(id): - return redirect("/settings/personal?error=Not a YouTube link!"), 400 + return redirect("/settings/personal?error=Not a YouTube link!") if path.isfile(f'/songs/{id}.mp3'): v.song = id g.db.add(v) @@ -886,15 +886,15 @@ def settings_song_change(v): req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json() duration = req['items'][0]['contentDetails']['duration'] if duration == 'P0D': - return redirect("/settings/personal?error=Can't use a live youtube video!"), 400 + return redirect("/settings/personal?error=Can't use a live youtube video!") if "H" in duration: - return redirect("/settings/personal?error=Duration of the video must not exceed 15 minutes!"), 400 + return redirect("/settings/personal?error=Duration of the video must not exceed 15 minutes!") if "M" in duration: duration = int(duration.split("PT")[1].split("M")[0]) if duration > 15: - return redirect("/settings/personal?error=Duration of the video must not exceed 15 minutes!"), 400 + return redirect("/settings/personal?error=Duration of the video must not exceed 15 minutes!") gevent.spawn(_change_song_youtube, v.id, id) @@ -905,13 +905,13 @@ def process_settings_plaintext(value, current, length): value = request.values.get(value, "").strip() if not value: - return redirect("/settings/personal?error=You didn't enter anything!"), 400 + return redirect("/settings/personal?error=You didn't enter anything!") if len(value) > 100: - return redirect("/settings/personal?error=The value you entered exceeds the character limit (100 characters)"), 400 + return redirect("/settings/personal?error=The value you entered exceeds the character limit (100 characters)") if value == current: - return redirect("/settings/personal?error=You didn't change anything!"), 400 + return redirect("/settings/personal?error=You didn't change anything!") return value