From 7713fd891de74e02d669d97215628878fc30dcab Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 2 Apr 2022 19:11:35 +0200 Subject: [PATCH] fsd --- files/classes/badges.py | 2 +- files/classes/clients.py | 2 +- files/classes/mod_logs.py | 2 +- files/classes/sub.py | 4 ++-- files/classes/submission.py | 8 ++++---- files/classes/user.py | 6 +++--- files/helpers/const.py | 2 +- files/routes/admin.py | 8 ++++---- files/routes/errors.py | 4 ++-- files/routes/feeds.py | 2 +- files/routes/front.py | 4 ++-- files/routes/login.py | 10 +++++----- files/routes/oauth.py | 6 +++--- files/routes/posts.py | 4 ++-- files/routes/settings.py | 22 +++++++++++----------- files/routes/static.py | 6 +++--- files/routes/users.py | 14 +++++++------- 17 files changed, 53 insertions(+), 53 deletions(-) diff --git a/files/classes/badges.py b/files/classes/badges.py index 12db64cf4..b3e70bda0 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -61,7 +61,7 @@ class Badge(Base): @property @lazy def path(self): - return f"{SITE_FULL}/assets/images/badges/{self.badge_id}.webp" + return f"/assets/images/badges/{self.badge_id}.webp" @property @lazy diff --git a/files/classes/clients.py b/files/classes/clients.py index b07e5db94..d16309895 100644 --- a/files/classes/clients.py +++ b/files/classes/clients.py @@ -36,7 +36,7 @@ class OauthApp(Base): @property @lazy - def permalink(self): return f"{SITE_FULL}/admin/app/{self.id}" + def permalink(self): return f"/admin/app/{self.id}" @lazy def idlist(self, page=1): diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index fb6cb6de6..720aad08c 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -107,7 +107,7 @@ class ModAction(Base): @property @lazy def permalink(self): - return f"{SITE_FULL}/log/{self.id}" + return f"/log/{self.id}" ACTIONTYPES = { 'agendaposter': { diff --git a/files/classes/sub.py b/files/classes/sub.py index 4aec6d6db..b1871bbcb 100644 --- a/files/classes/sub.py +++ b/files/classes/sub.py @@ -32,13 +32,13 @@ class Sub(Base): @lazy def sidebar_url(self): if self.sidebarurl: return SITE_FULL + self.sidebarurl - return f'{SITE_FULL}/assets/images/{SITE_NAME}/sidebar.webp?v=1041' + return f'/assets/images/{SITE_NAME}/sidebar.webp?v=1041' @property @lazy def banner_url(self): if self.bannerurl: return SITE_FULL + self.bannerurl - return f'{SITE_FULL}/assets/images/{SITE_NAME}/banner.webp?v=1042' + return f'/assets/images/{SITE_NAME}/banner.webp?v=1042' @property @lazy diff --git a/files/classes/submission.py b/files/classes/submission.py index 958b4ef67..40d63af40 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -249,13 +249,13 @@ class Submission(Base): @property @lazy def thumb_url(self): - if self.over_18: return f"{SITE_FULL}/assets/images/nsfw.webp?v=1" - elif not self.url: return f"{SITE_FULL}/assets/images/{SITE_NAME}/default_text.webp?v=1" + if self.over_18: return "/assets/images/nsfw.webp?v=1" + elif not self.url: return f"/assets/images/{SITE_NAME}/default_text.webp?v=1" elif self.thumburl: if self.thumburl.startswith('/'): return SITE_FULL + self.thumburl return self.thumburl - elif self.is_youtube or self.is_video: return f"{SITE_FULL}/assets/images/default_thumb_yt.webp?v=1" - else: return f"{SITE_FULL}/assets/images/default_thumb_link.webp?v=1" + elif self.is_youtube or self.is_video: return "/assets/images/default_thumb_yt.webp?v=1" + else: return "/assets/images/default_thumb_link.webp?v=1" @property @lazy diff --git a/files/classes/user.py b/files/classes/user.py index aeb643732..7349491d5 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -350,7 +350,7 @@ class User(Base): @property @lazy def url(self): - return f"{SITE_FULL}/@{self.username}" + return f"/@{self.username}" def __repr__(self): return f"" @@ -470,7 +470,7 @@ class User(Base): @lazy def banner_url(self): if self.bannerurl: return self.bannerurl - else: return f"{SITE_FULL}/assets/images/{SITE_NAME}/site_preview.webp?v=1013" + else: return f"/assets/images/{SITE_NAME}/site_preview.webp?v=1013" @property @lazy @@ -479,7 +479,7 @@ class User(Base): if self.profileurl: if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl return self.profileurl - return f"{SITE_FULL}/assets/images/default-profile-pic.webp?v=1008" + return "/assets/images/default-profile-pic.webp?v=1008" @lazy def json_popover(self, v): diff --git a/files/helpers/const.py b/files/helpers/const.py index 66891c475..377350d63 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -144,7 +144,7 @@ if SITE in {'rdrama.net','devrama.xyz'}: MOM_ID = 4588 DONGER_ID = 541 BUG_THREAD = 18459 - WELCOME_MSG = f"Hi there! It's me, your soon-to-be favorite rDrama user @carpathianflorist here to give you a brief rundown on some of the sick features we have here. You'll probably want to start by following me, though. So go ahead and click my name and then smash that Follow button. This is actually really important, so go on. Hurry.\n\nThanks!\n\nNext up: If you're a member of the media, similarly just shoot me a DM and I'll set about verifying you and then we can take care of your sad journalism stuff.\n\n**FOR EVERYONE ELSE**\n\n Begin by navigating to [the settings page]({SITE_FULL}/settings/profile) (we'll be prettying this up so it's less convoluted soon, don't worry) and getting some basic customization done.\n\n### Themes\n\nDefinitely change your theme right away, the default one (Midnight) is pretty enough, but why not use something *exotic* like Win98, or *flashy* like Tron? Even Coffee is super tasteful and way more fun than the default. More themes to come when we get around to it!\n\n### Avatar/pfp\n\nYou'll want to set this pretty soon; without uploading one, I put together a randomly-assigned selection of 180ish pictures of furries, ugly goths, mujahideen, anime girls, and My Little Ponys which are used by everyone who was too lazy to set a pfp. Set the banner too while you're at it. Your profile is important!\n\n### Flairs\n\nSince you're already on the settings page, you may as well set a flair, too. As with your username, you can - obviously - choose the color of this, either with a hex value or just from the preset colors. And also like your username, you can change this at any time. [Paypigs](https://marsey1.gumroad.com/l/tfcvri) can even further relive the glory days of 90s-00s internet and set obnoxious signatures.\n\n### PROFILE ANTHEMS\n\nSpeaking of profiles, hey, remember MySpace? Do you miss autoplaying music assaulting your ears every time you visited a friend's page? Yeah, we brought that back. Enter a YouTube URL, wait a few seconds for it to process, and then BAM! you've got a profile anthem which people cannot mute. Unless they spend 20,000 dramacoin in the shop for a mute button. Which you can then remove from your profile by spending 40,000 dramacoin on an unmuteable anthem. Get fucked poors!\n\n### Dramacoin?\n\nDramacoin is basically our take on the karma system. Except unlike the karma system, it's not gay and boring and stupid and useless. Dramacoin can be spent at [Marsey's Dramacoin Emporium]({SITE_FULL}/shop) on upgrades to your user experience (many more coming than what's already listed there), and best of all on tremendously annoying awards to fuck with your fellow dramautists. We're always adding more, so check back regularly in case you happen to miss one of the announcement posts. Holiday-themed awards are currently unavailable while we resolve an internal dispute, but they **will** return, no matter what some other janitors insist.\n\nLike karma, dramacoin is obtained by getting upvotes on your threads and comments. *Unlike* karma, it's also obtained by getting downvotes on your threads and comments. Downvotes don't really do anything here - they pay the same amount of dramacoin and they increase thread/comment ranking just the same as an upvote. You just use them to express petty disapproval and hopefully start a fight. Because all votes are visible here. To hell with your anonymity.\n\nDramacoin can also be traded amongst users from their profiles. Note that there is a 3% transaction fee.\n\n**Dramacoin and shop items cannot be purchased with real money and this will not change.** Though we are notoriously susceptible to bribes, so definitely shoot your shot. It'll probably go well, honestly.\n\n### Badges\n\nRemember all those neat little metallic icons you saw on my profile when you were following me? If not, scroll back up and go have a look. And doublecheck to make sure you pressed the Follow button. Anyway, those are badges. You earn them by doing a variety of things. Some of them even offer benefits, like discounts at the shop. A [complete list of badges and their requirements can be found here]({SITE_FULL}/badges), though I add more pretty regularly, so keep an eye on the changelog.\n\n### Other stuff\n\nWe're always adding new features, and we take a fun-first approach to development. If you have a suggestion for something that would be fun, funny, annoying - or best of all, some combination of all three - definitely make a thread about it. Or just DM me if you're shy. Weirdo. Anyway there's also the [leaderboards]({SITE_FULL}/leaderboard), boring stuff like two-factor authentication you can toggle on somewhere in the settings page (psycho), the ability to save posts and comments, close to a thousand emojis already (several hundred of which are rDrama originals), and on and on and on and on. This is just the basics, mostly to help you get acquainted with some of the things you can do here to make it more easy on the eyes, customizable, and enjoyable. If you don't enjoy it, just go away! We're not changing things to suit you! Get out of here loser! And no, you can't delete your account :na:\n\nI love you.
*xoxo Carp* 💋" + WELCOME_MSG = "Hi there! It's me, your soon-to-be favorite rDrama user @carpathianflorist here to give you a brief rundown on some of the sick features we have here. You'll probably want to start by following me, though. So go ahead and click my name and then smash that Follow button. This is actually really important, so go on. Hurry.\n\nThanks!\n\nNext up: If you're a member of the media, similarly just shoot me a DM and I'll set about verifying you and then we can take care of your sad journalism stuff.\n\n**FOR EVERYONE ELSE**\n\n Begin by navigating to [the settings page](/settings/profile) (we'll be prettying this up so it's less convoluted soon, don't worry) and getting some basic customization done.\n\n### Themes\n\nDefinitely change your theme right away, the default one (Midnight) is pretty enough, but why not use something *exotic* like Win98, or *flashy* like Tron? Even Coffee is super tasteful and way more fun than the default. More themes to come when we get around to it!\n\n### Avatar/pfp\n\nYou'll want to set this pretty soon; without uploading one, I put together a randomly-assigned selection of 180ish pictures of furries, ugly goths, mujahideen, anime girls, and My Little Ponys which are used by everyone who was too lazy to set a pfp. Set the banner too while you're at it. Your profile is important!\n\n### Flairs\n\nSince you're already on the settings page, you may as well set a flair, too. As with your username, you can - obviously - choose the color of this, either with a hex value or just from the preset colors. And also like your username, you can change this at any time. [Paypigs](https://marsey1.gumroad.com/l/tfcvri) can even further relive the glory days of 90s-00s internet and set obnoxious signatures.\n\n### PROFILE ANTHEMS\n\nSpeaking of profiles, hey, remember MySpace? Do you miss autoplaying music assaulting your ears every time you visited a friend's page? Yeah, we brought that back. Enter a YouTube URL, wait a few seconds for it to process, and then BAM! you've got a profile anthem which people cannot mute. Unless they spend 20,000 dramacoin in the shop for a mute button. Which you can then remove from your profile by spending 40,000 dramacoin on an unmuteable anthem. Get fucked poors!\n\n### Dramacoin?\n\nDramacoin is basically our take on the karma system. Except unlike the karma system, it's not gay and boring and stupid and useless. Dramacoin can be spent at [Marsey's Dramacoin Emporium](/shop) on upgrades to your user experience (many more coming than what's already listed there), and best of all on tremendously annoying awards to fuck with your fellow dramautists. We're always adding more, so check back regularly in case you happen to miss one of the announcement posts. Holiday-themed awards are currently unavailable while we resolve an internal dispute, but they **will** return, no matter what some other janitors insist.\n\nLike karma, dramacoin is obtained by getting upvotes on your threads and comments. *Unlike* karma, it's also obtained by getting downvotes on your threads and comments. Downvotes don't really do anything here - they pay the same amount of dramacoin and they increase thread/comment ranking just the same as an upvote. You just use them to express petty disapproval and hopefully start a fight. Because all votes are visible here. To hell with your anonymity.\n\nDramacoin can also be traded amongst users from their profiles. Note that there is a 3% transaction fee.\n\n**Dramacoin and shop items cannot be purchased with real money and this will not change.** Though we are notoriously susceptible to bribes, so definitely shoot your shot. It'll probably go well, honestly.\n\n### Badges\n\nRemember all those neat little metallic icons you saw on my profile when you were following me? If not, scroll back up and go have a look. And doublecheck to make sure you pressed the Follow button. Anyway, those are badges. You earn them by doing a variety of things. Some of them even offer benefits, like discounts at the shop. A [complete list of badges and their requirements can be found here](/badges), though I add more pretty regularly, so keep an eye on the changelog.\n\n### Other stuff\n\nWe're always adding new features, and we take a fun-first approach to development. If you have a suggestion for something that would be fun, funny, annoying - or best of all, some combination of all three - definitely make a thread about it. Or just DM me if you're shy. Weirdo. Anyway there's also the [leaderboards](/leaderboard), boring stuff like two-factor authentication you can toggle on somewhere in the settings page (psycho), the ability to save posts and comments, close to a thousand emojis already (several hundred of which are rDrama originals), and on and on and on and on. This is just the basics, mostly to help you get acquainted with some of the things you can do here to make it more easy on the eyes, customizable, and enjoyable. If you don't enjoy it, just go away! We're not changing things to suit you! Get out of here loser! And no, you can't delete your account :na:\n\nI love you.
*xoxo Carp* 💋" elif SITE == "pcmemes.net": NOTIFICATIONS_ID = 1046 AUTOJANNY_ID = 1050 diff --git a/files/routes/admin.py b/files/routes/admin.py index 10eece179..247c5eb7e 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -35,7 +35,7 @@ def merge(v, id1, id2): path = request.path qs = urlencode(dict(request.values)) argval = quote(f"{path}?{qs}", safe='') - return redirect(f"{SITE_FULL}/login?redirect={argval}") + return redirect(f"/login?redirect={argval}") user1 = get_account(id1) user2 = get_account(id2) @@ -95,7 +95,7 @@ def merge_all(v, id): path = request.path qs = urlencode(dict(request.values)) argval = quote(f"{path}?{qs}", safe='') - return redirect(f"{SITE_FULL}/login?redirect={argval}") + return redirect(f"/login?redirect={argval}") user = get_account(id) @@ -849,7 +849,7 @@ def admin_link_accounts(v): g.db.add(ma) g.db.commit() - return redirect(f"{SITE_FULL}/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}") + return redirect(f"/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}") @app.get("/admin/removed/posts") @@ -1582,7 +1582,7 @@ def admin_toggle_ban_domain(v): g.db.commit() - return redirect(f"{SITE_FULL}/admin/banned_domains/") + return redirect("/admin/banned_domains/") @app.post("/admin/nuke_user") diff --git a/files/routes/errors.py b/files/routes/errors.py index 29c2ceba9..fe19176c1 100644 --- a/files/routes/errors.py +++ b/files/routes/errors.py @@ -19,7 +19,7 @@ def error_401(e): path = request.path qs = urlencode(dict(request.values)) argval = quote(f"{path}?{qs}", safe='') - return redirect(f"{SITE_FULL}/login?redirect={argval}") + return redirect(f"/login?redirect={argval}") @app.errorhandler(403) def error_403(e): @@ -62,4 +62,4 @@ def allow_nsfw(): if redir: if redir.startswith(SITE_FULL): return redirect(redir) if redir.startswith('/'): return redirect(f'{SITE_FULL}{redir}') - return redirect(f'{SITE_FULL}/') \ No newline at end of file + return redirect('/') \ No newline at end of file diff --git a/files/routes/feeds.py b/files/routes/feeds.py index c95c98157..9a44350d2 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -53,7 +53,7 @@ def feeds_user(v=None, sort='hot', t='all'): with tag("name"): text(post.author_name) with tag("uri"): - text(f'{SITE_FULL}/@{post.author_name}') + text(f'/@{post.author_name}') doc.stag("link", href=post.permalink) diff --git a/files/routes/front.py b/files/routes/front.py index efb2dcfd5..d1f51838c 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -149,7 +149,7 @@ def front_all(v, sub=None, subdomain=None): session["session_id"] = secrets.token_hex(49) if not v and request.path == "/" and not request.headers.get("Authorization"): - return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -480,7 +480,7 @@ def random_post(v): n = random.randint(1, total - 2) post = x.offset(n).limit(1).one_or_none() - return redirect(f"{SITE_FULL}/post/{post.id}") + return redirect(f"/post/{post.id}") @app.get("/comments") @auth_required diff --git a/files/routes/login.py b/files/routes/login.py index d893d6833..119c0db95 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -121,11 +121,11 @@ def login_post(): now = int(time.time()) if now - int(request.values.get("time")) > 600: - return redirect(f'{SITE_FULL}/login') + return redirect('/login') formhash = request.values.get("hash") if not validate_hash(f"{account.id}+{request.values.get('time')}+2fachallenge", formhash): - return redirect(f"{SITE_FULL}/login") + return redirect("/login") if not account.validate_2fa(request.values.get("2fa_token", "").strip()): hash = generate_hash(f"{account.id}+{time}+2fachallenge") @@ -154,7 +154,7 @@ def login_post(): if redir: if redir.startswith(SITE_FULL): return redirect(redir) if redir.startswith('/'): return redirect(f'{SITE_FULL}{redir}') - return redirect(f'{SITE_FULL}/') + return redirect('/') @app.get("/me") @app.get("/@me") @@ -258,7 +258,7 @@ def sign_up_post(v): user = g.db.query(User).filter_by(id=request.values.get("referred_by")).one_or_none() if user: args["ref"] = user.username - return redirect(f"{SITE_FULL}/signup?{urlencode(args)}") + return redirect(f"/signup?{urlencode(args)}") if now - int(form_timestamp) < 5: return signup_error("There was a problem. Please try again.") @@ -442,7 +442,7 @@ def get_reset(): @limiter.limit("1/second;30/minute;200/hour;1000/day") @auth_desired def post_reset(v): - if v: return redirect(f'{SITE_FULL}/') + if v: return redirect('/') user_id = request.values.get("user_id") diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 8fd04d902..2bd890b62 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -73,7 +73,7 @@ def request_api_keys(v): g.db.commit() - return redirect(f'{SITE_FULL}/settings/apps') + return redirect('/settings/apps') @app.post("/delete_app/") @@ -93,7 +93,7 @@ def delete_oauth_app(v, aid): g.db.commit() - return redirect(f'{SITE_FULL}/apps') + return redirect('/apps') @app.post("/edit_app/") @@ -114,7 +114,7 @@ def edit_oauth_app(v, aid): g.db.commit() - return redirect(f'{SITE_FULL}/settings/apps') + return redirect('/settings/apps') @app.post("/admin/app/approve/") diff --git a/files/routes/posts.py b/files/routes/posts.py index f732082aa..f883acea8 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -123,7 +123,7 @@ def submit_get(v, sub=None): @auth_desired def post_id(pid, anything=None, v=None, sub=None): if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"): - return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -990,7 +990,7 @@ def submit_post(v, sub=None): _note="spam" ) g.db.add(ma) - return redirect(f"{SITE_FULL}/notifications") + return redirect("/notifications") if len(str(body)) > 20000: return error("There's a 20000 character limit for text body.") diff --git a/files/routes/settings.py b/files/routes/settings.py index a96c463f8..7b6a43c0d 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -399,7 +399,7 @@ def namecolor(v): v.namecolor = color g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.post("/settings/themecolor") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -412,7 +412,7 @@ def themecolor(v): v.themecolor = themecolor g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.post("/settings/gumroad") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -476,7 +476,7 @@ def titlecolor(v): v.titlecolor = titlecolor g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.post("/settings/verifiedcolor") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -488,7 +488,7 @@ def verifiedcolor(v): v.verifiedcolor = verifiedcolor g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.post("/settings/security") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -775,7 +775,7 @@ def settings_remove_discord(v): g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.get("/settings/content") @auth_required @@ -825,7 +825,7 @@ def settings_name_change(v): g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.post("/settings/song_change") @limiter.limit("2/second;10/day") @@ -839,7 +839,7 @@ def settings_song_change(v): v.song = None g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") song = song.replace("https://music.youtube.com", "https://youtube.com") if song.startswith(("https://www.youtube.com/watch?v=", "https://youtube.com/watch?v=", "https://m.youtube.com/watch?v=")): @@ -856,7 +856,7 @@ def settings_song_change(v): v.song = id g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json() @@ -904,7 +904,7 @@ def settings_song_change(v): g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.post("/settings/title_change") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -925,13 +925,13 @@ def settings_title_change(v): g.db.add(v) g.db.commit() - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.get("/settings") @auth_required def settings(v): - return redirect(f"{SITE_FULL}/settings/profile") + return redirect("/settings/profile") @app.get("/settings/profile") diff --git a/files/routes/static.py b/files/routes/static.py index 1eeb92aac..a5d9713e6 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -41,7 +41,7 @@ def marsey_list(): @app.get("/logged_out/terms") @auth_desired def terms(v): - if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -51,7 +51,7 @@ def terms(v): @app.get('/logged_out/sidebar') @auth_desired def sidebar(v): - if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -333,7 +333,7 @@ def submit_contact(v): @app.get('/archives') def archivesindex(): - return redirect(f"{SITE_FULL}/archives/index.html") + return redirect("/archives/index.html") @app.get('/archives/') def archives(path): diff --git a/files/routes/users.py b/files/routes/users.py index 34fd39ad4..3e07d7194 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -554,7 +554,7 @@ def get_profilecss(username): @app.get("/@/song") def usersong(username): user = get_user(username) - if user.song: return redirect(f"{SITE_FULL}/song/{user.song}.mp3") + if user.song: return redirect(f"/song/{user.song}.mp3") else: abort(404) @app.get("/song/") @@ -587,7 +587,7 @@ def unsubscribe(v, post_id): @app.get("/report_bugs") @auth_required def reportbugs(v): - return redirect(f'{SITE_FULL}/post/{BUG_THREAD}') + return redirect(f'/post/{BUG_THREAD}') @app.post("/@/message") @limiter.limit("1/second;10/minute;20/hour;50/day") @@ -771,7 +771,7 @@ def user_id(id, v): @app.get("/u/") @auth_required def redditor_moment_redirect(username, v): - return redirect(f"{SITE_FULL}/@{username}") + return redirect(f"/@{username}") @app.get("/@/followers") @auth_required @@ -801,7 +801,7 @@ def visitors(v): def u_username(username, v=None): - if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -893,13 +893,13 @@ def u_username(username, v=None): def u_username_comments(username, v=None): - if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None user = get_user(username, v=v) - if username != user.username: return redirect(f'{SITE_FULL}/@{user.username}/comments') + if username != user.username: return redirect(f'/@{user.username}/comments') u = user @@ -1083,7 +1083,7 @@ def user_profile_uid(v, id): try: id = int(id, 36) except: abort(404) - if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}") + if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None