From 12b0d822af66f1c035ecd6b10b7d19d818de7de6 Mon Sep 17 00:00:00 2001 From: G-tix Date: Wed, 9 Aug 2023 17:05:38 +0000 Subject: [PATCH 1/2] Remove unnecessary 400 redirects The redirects are confusing people (including me lol). --- files/routes/settings.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 -- 2.34.1 From 0ffc2e6228ca045ecb370a528feb4aa49498e655 Mon Sep 17 00:00:00 2001 From: G-tix Date: Wed, 9 Aug 2023 17:10:10 +0000 Subject: [PATCH 2/2] Remove temp event stuff If still needed, please ignore. --- files/routes/posts.py | 3 --- 1 file changed, 3 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 -- 2.34.1