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: rDrama/rDrama#183
Co-authored-by: G-tix <g-tix@noreply.fsdfsd.net>
Co-committed-by: G-tix <g-tix@noreply.fsdfsd.net>
master
G-tix 2023-08-10 12:37:57 +00:00 committed by Aevann
parent 6ce7a042ea
commit 4602e374ee
2 changed files with 8 additions and 11 deletions

View File

@ -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

View File

@ -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