make going to the reddit version of archived posts easier

pull/31/head
Aevann1 2022-11-29 01:45:52 +02:00
parent 3d1c16044a
commit b6c45c4208
1 changed files with 8 additions and 0 deletions

View File

@ -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/<subreddit>/comments/<path:path>")
@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):