From b6c45c4208c7dc5fe4093e0afcf006c599ac2bdb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 29 Nov 2022 01:45:52 +0200 Subject: [PATCH] make going to the reddit version of archived posts easier --- files/routes/static.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/files/routes/static.py b/files/routes/static.py index 7bb6a0b5c..8909526bc 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -28,6 +28,14 @@ def subreddit(subreddit, v): reddit = v.reddit if v else "old.reddit.com" return redirect(f'https://{reddit}/r/{subreddit}') +@app.get("/archives//comments/") +@auth_desired +def reddit_post(subreddit, v, path): + post_id = path.rsplit("/", 1)[0].replace('/', '') + reddit = v.reddit if v else "old.reddit.com" + return redirect(f'https://{reddit}/{post_id}') + + @app.get("/marseys") @auth_required def marseys(v:User):