From 462e3421b58a47dc012098244113a287b00b9ce8 Mon Sep 17 00:00:00 2001 From: geese-suck <16601315+geese-suck@users.noreply.github.com> Date: Tue, 8 Nov 2022 22:11:46 -0800 Subject: [PATCH] organize templates (#435) dude file management lmao --- files/routes/settings.py | 110 +++++++++--------- files/routes/users.py | 42 +++---- .../advanced.html} | 2 +- .../apps.html} | 0 .../common.html} | 0 .../{settings_css.html => settings/css.html} | 0 .../personal.html} | 2 +- .../security.html} | 0 files/templates/userpage.html | 2 +- .../admintools.html} | 0 files/templates/{ => userpage}/blockers.html | 0 .../blocking.html} | 0 .../comments.html} | 0 files/templates/{ => userpage}/followers.html | 0 files/templates/{ => userpage}/following.html | 0 .../private.html} | 0 files/templates/{ => userpage}/viewers.html | 0 .../{ => userpage}/voted_comments.html | 0 .../templates/{ => userpage}/voted_posts.html | 0 files/templates/{ => userpage}/voters.html | 0 20 files changed, 79 insertions(+), 79 deletions(-) rename files/templates/{settings_advanced.html => settings/advanced.html} (99%) rename files/templates/{settings_apps.html => settings/apps.html} (100%) rename files/templates/{settings_common.html => settings/common.html} (100%) rename files/templates/{settings_css.html => settings/css.html} (100%) rename files/templates/{settings_personal.html => settings/personal.html} (99%) rename files/templates/{settings_security.html => settings/security.html} (100%) rename files/templates/{userpage_admintools.html => userpage/admintools.html} (100%) rename files/templates/{ => userpage}/blockers.html (100%) rename files/templates/{userpage_blocking.html => userpage/blocking.html} (100%) rename files/templates/{userpage_comments.html => userpage/comments.html} (100%) rename files/templates/{ => userpage}/followers.html (100%) rename files/templates/{ => userpage}/following.html (100%) rename files/templates/{userpage_private.html => userpage/private.html} (100%) rename files/templates/{ => userpage}/viewers.html (100%) rename files/templates/{ => userpage}/voted_comments.html (100%) rename files/templates/{ => userpage}/voted_posts.html (100%) rename files/templates/{ => userpage}/voters.html (100%) diff --git a/files/routes/settings.py b/files/routes/settings.py index 0b1d22b40..4b4b9b58c 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -24,7 +24,7 @@ def settings(v): @app.get("/settings/personal") @auth_required def settings_personal(v): - return render_template("settings_personal.html", v=v) + return render_template("settings/personal.html", v=v) @app.delete('/settings/background') @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -64,7 +64,7 @@ def settings_personal_post(v): request_flag = int(time.time()) setattr(v, column_name, request_flag) if badge_id: badge_grant(v, badge_id) - return render_template("settings_personal.html", v=v, msg=f"You have set the {friendly_name} permanently! Enjoy your new badge!") + return render_template("settings/personal.html", v=v, msg=f"You have set the {friendly_name} permanently! Enjoy your new badge!") elif current_value != request_flag: setattr(v, column_name, request_flag) return True @@ -134,38 +134,38 @@ def settings_personal_post(v): v.bio = None v.bio_html = None g.db.add(v) - return render_template("settings_personal.html", v=v, msg="Your bio has been updated.") + return render_template("settings/personal.html", v=v, msg="Your bio has been updated.") elif not updated and request.values.get("sig") == "": v.sig = None v.sig_html = None g.db.add(v) - return render_template("settings_personal.html", v=v, msg="Your sig has been updated.") + return render_template("settings/personal.html", v=v, msg="Your sig has been updated.") elif not updated and request.values.get("friends") == "": v.friends = None v.friends_html = None g.db.add(v) - return render_template("settings_personal.html", v=v, msg="Your friends list has been updated.") + return render_template("settings/personal.html", v=v, msg="Your friends list has been updated.") elif not updated and request.values.get("enemies") == "": v.enemies = None v.enemies_html = None g.db.add(v) - return render_template("settings_personal.html", v=v, msg="Your enemies list has been updated.") + return render_template("settings/personal.html", v=v, msg="Your enemies list has been updated.") elif not updated and v.patron and request.values.get("sig"): sig = request.values.get("sig")[:200].replace('\n','').replace('\r','') sig_html = sanitize(sig) if len(sig_html) > 1000: - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="Your sig is too long") v.sig = sig[:200] v.sig_html=sig_html g.db.add(v) - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, msg="Your sig has been updated.") @@ -175,7 +175,7 @@ def settings_personal_post(v): friends_html = sanitize(friends) if len(friends_html) > 2000: - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="Your friends list is too long") @@ -189,7 +189,7 @@ def settings_personal_post(v): v.friends = friends[:500] v.friends_html=friends_html g.db.add(v) - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, msg="Your friends list has been updated.") @@ -200,7 +200,7 @@ def settings_personal_post(v): enemies_html = sanitize(enemies) if len(enemies_html) > 2000: - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="Your enemies list is too long") @@ -213,7 +213,7 @@ def settings_personal_post(v): v.enemies = enemies[:500] v.enemies_html=enemies_html g.db.add(v) - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, msg="Your enemies list has been updated.") @@ -226,7 +226,7 @@ def settings_personal_post(v): bio_html = sanitize(bio) if len(bio_html) > 10000: - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="Your bio is too long") @@ -235,7 +235,7 @@ def settings_personal_post(v): v.bio = bio[:1500] v.bio_html=bio_html g.db.add(v) - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, msg="Your bio has been updated.") @@ -298,11 +298,11 @@ def filters(v): filters=request.values.get("filters")[:1000].strip() if filters == v.custom_filter_list: - return render_template("settings_advanced.html", v=v, error="You didn't change anything") + return render_template("settings/advanced.html", v=v, error="You didn't change anything") v.custom_filter_list=filters g.db.add(v) - return render_template("settings_advanced.html", v=v, msg="Your custom filters have been updated.") + return render_template("settings/advanced.html", v=v, msg="Your custom filters have been updated.") def set_color(v:User, attr:str, color:Optional[str]): @@ -311,7 +311,7 @@ def set_color(v:User, attr:str, color:Optional[str]): if color: if color.startswith('#'): color = color[1:] if not color_regex.fullmatch(color): - return render_template("settings_personal.html", v=v, error="Invalid color hex code") + return render_template("settings/personal.html", v=v, error="Invalid color hex code") if color and current != color: setattr(v, attr, color) g.db.add(v) @@ -390,27 +390,27 @@ def verifiedcolor(v): def settings_security_post(v): if request.values.get("new_password"): if request.values.get("new_password") != request.values.get("cnf_password"): - return render_template("settings_security.html", v=v, error="Passwords do not match.") + return render_template("settings/security.html", v=v, error="Passwords do not match.") if not valid_password_regex.fullmatch(request.values.get("new_password")): - return render_template("settings_security.html", v=v, error="Password must be between 8 and 100 characters.") + return render_template("settings/security.html", v=v, error="Password must be between 8 and 100 characters.") if not v.verifyPass(request.values.get("old_password")): - return render_template("settings_security.html", v=v, error="Incorrect password") + return render_template("settings/security.html", v=v, error="Incorrect password") v.passhash = hash_password(request.values.get("new_password")) g.db.add(v) - return render_template("settings_security.html", v=v, msg="Your password has been changed.") + return render_template("settings/security.html", v=v, msg="Your password has been changed.") if request.values.get("new_email"): if not v.verifyPass(request.values.get('password')): - return render_template("settings_security.html", v=v, error="Invalid password.") + return render_template("settings/security.html", v=v, error="Invalid password.") new_email = request.values.get("new_email","").strip().lower() if new_email == v.email: - return render_template("settings_security.html", v=v, error="This email is already yours!") + return render_template("settings/security.html", v=v, error="This email is already yours!") url = f"{SITE_FULL}/activate" @@ -432,29 +432,29 @@ def settings_security_post(v): if request.values.get("2fa_token"): if not v.verifyPass(request.values.get('password')): - return render_template("settings_security.html", v=v, error="Invalid password or token.") + return render_template("settings/security.html", v=v, error="Invalid password or token.") secret = request.values.get("2fa_secret") x = pyotp.TOTP(secret) if not x.verify(request.values.get("2fa_token"), valid_window=1): - return render_template("settings_security.html", v=v, error="Invalid password or token.") + return render_template("settings/security.html", v=v, error="Invalid password or token.") v.mfa_secret = secret g.db.add(v) - return render_template("settings_security.html", v=v, msg="Two-factor authentication enabled.") + return render_template("settings/security.html", v=v, msg="Two-factor authentication enabled.") if request.values.get("2fa_remove"): if not v.verifyPass(request.values.get('password')): - return render_template("settings_security.html", v=v, error="Invalid password or token.") + return render_template("settings/security.html", v=v, error="Invalid password or token.") token = request.values.get("2fa_remove") if not v.validate_2fa(token): - return render_template("settings_security.html", v=v, error="Invalid password or token.") + return render_template("settings/security.html", v=v, error="Invalid password or token.") v.mfa_secret = None g.db.add(v) - return render_template("settings_security.html", v=v, msg="Two-factor authentication disabled.") + return render_template("settings/security.html", v=v, msg="Two-factor authentication disabled.") @app.post("/settings/log_out_all_others") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -463,12 +463,12 @@ def settings_security_post(v): def settings_log_out_others(v): submitted_password = request.values.get("password", "").strip() if not v.verifyPass(submitted_password): - return render_template("settings_security.html", v=v, error="Incorrect Password"), 401 + return render_template("settings/security.html", v=v, error="Incorrect Password"), 401 v.login_nonce += 1 session["login_nonce"] = v.login_nonce g.db.add(v) - return render_template("settings_security.html", v=v, msg="All other devices have been logged out") + return render_template("settings/security.html", v=v, msg="All other devices have been logged out") @app.post("/settings/images/profile") @@ -503,7 +503,7 @@ def settings_images_profile(v): g.db.add(v) - return render_template("settings_personal.html", v=v, msg="Profile picture successfully updated.") + return render_template("settings/personal.html", v=v, msg="Profile picture successfully updated.") @app.post("/settings/images/banner") @@ -527,12 +527,12 @@ def settings_images_banner(v): v.bannerurl = bannerurl g.db.add(v) - return render_template("settings_personal.html", v=v, msg="Banner successfully updated.") + return render_template("settings/personal.html", v=v, msg="Banner successfully updated.") @app.get("/settings/css") @auth_required def settings_css_get(v): - return render_template("settings_css.html", v=v) + return render_template("settings/css.html", v=v) @app.post("/settings/css") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -546,7 +546,7 @@ def settings_css(v): v.css = css g.db.add(v) - return render_template("settings_css.html", v=v) + return render_template("settings/css.html", v=v) @app.post("/settings/profilecss") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -556,7 +556,7 @@ def settings_profilecss(v): profilecss = request.values.get("profilecss", v.profilecss).strip().replace('\\', '').strip()[:4000] valid, error = validate_css(profilecss) if not valid: - return render_template("settings_css.html", error=error, v=v) + return render_template("settings/css.html", error=error, v=v) v.profilecss = profilecss g.db.add(v) return redirect('/settings/css') @@ -564,7 +564,7 @@ def settings_profilecss(v): @app.get("/settings/security") @auth_required def settings_security(v): - return render_template("settings_security.html", + return render_template("settings/security.html", v=v, mfa_secret=pyotp.random_base32() if not v.mfa_secret else None, now=int(time.time()) @@ -614,12 +614,12 @@ def settings_unblock_user(v): @app.get("/settings/apps") @auth_required def settings_apps(v): - return render_template("settings_apps.html", v=v) + return render_template("settings/apps.html", v=v) @app.get("/settings/advanced") @auth_required def settings_advanced_get(v): - return render_template("settings_advanced.html", v=v) + return render_template("settings/advanced.html", v=v) @app.post("/settings/name_change") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -629,12 +629,12 @@ def settings_name_change(v): new_name=request.values.get("name").strip() if new_name==v.username: - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="You didn't change anything") if not valid_username_regex.fullmatch(new_name): - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="This isn't a valid username.") @@ -648,7 +648,7 @@ def settings_name_change(v): ).one_or_none() if x and x.id != v.id: - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error=f"Username `{new_name}` is already in use.") @@ -667,7 +667,7 @@ def settings_name_change(v): def settings_song_change_mp3(v): file = request.files['file'] if file.content_type != 'audio/mpeg': - return render_template("settings_personal.html", v=v, error="Not a valid MP3 file") + return render_template("settings/personal.html", v=v, error="Not a valid MP3 file") song = str(time.time()).replace('.','') @@ -677,7 +677,7 @@ def settings_song_change_mp3(v): size = os.stat(name).st_size if size > 8 * 1024 * 1024: os.remove(name) - return render_template("settings_personal.html", v=v, error="MP3 file must be smaller than 8MB") + return render_template("settings/personal.html", v=v, error="MP3 file must be smaller than 8MB") if path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User).filter_by(song=v.song).count() == 1: os.remove(f"/songs/{v.song}.mp3") @@ -708,7 +708,7 @@ def settings_song_change(v): elif song.startswith("https://youtu.be/"): id = song.split("https://youtu.be/")[1] else: - return render_template("settings_personal.html", v=v, error="Not a youtube link.") + return render_template("settings/personal.html", v=v, error="Not a youtube link.") if "?" in id: id = id.split("?")[0] if "&" in id: id = id.split("&")[0] @@ -722,15 +722,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 render_template("settings_personal.html", v=v, error="Can't use a live youtube video!") + return render_template("settings/personal.html", v=v, error="Can't use a live youtube video!") if "H" in duration: - return render_template("settings_personal.html", v=v, error="Duration of the video must not exceed 15 minutes.") + return render_template("settings/personal.html", v=v, 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 render_template("settings_personal.html", v=v, error="Duration of the video must not exceed 15 minutes.") + return render_template("settings/personal.html", v=v, error="Duration of the video must not exceed 15 minutes.") if v.song and path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User).filter_by(song=v.song).count() == 1: @@ -750,7 +750,7 @@ def settings_song_change(v): try: ydl.download([f"https://youtube.com/watch?v={id}"]) except Exception as e: print(e, flush=True) - return render_template("settings_personal.html", + return render_template("settings/personal.html", v=v, error="Age-restricted videos aren't allowed.") @@ -772,13 +772,13 @@ def settings_title_change(v): customtitleplain = sanitize_settings_text(request.values.get("title"), 100) if customtitleplain == v.customtitleplain: - return render_template("settings_personal.html", v=v, error="You didn't change anything") + return render_template("settings/personal.html", v=v, error="You didn't change anything") customtitle = filter_emojis_only(customtitleplain) customtitle = censor_slurs(customtitle, None) if len(customtitle) > 1000: - return render_template("settings_personal.html", v=v, error="Flair too long!") + return render_template("settings/personal.html", v=v, error="Flair too long!") v.customtitleplain = customtitleplain v.customtitle = customtitle @@ -796,13 +796,13 @@ def settings_pronouns_change(v): pronouns = sanitize_settings_text(request.values.get("pronouns")) if len(pronouns) > 11: - return render_template("settings_personal.html", v=v, error="Your pronouns exceed the character limit (11 characters)") + return render_template("settings/personal.html", v=v, error="Your pronouns exceed the character limit (11 characters)") if pronouns == v.pronouns: - return render_template("settings_personal.html", v=v, error="You didn't change anything.") + return render_template("settings/personal.html", v=v, error="You didn't change anything.") if not pronouns_regex.fullmatch(pronouns): - return render_template("settings_personal.html", v=v, error="The pronouns you entered don't match the required format.") + return render_template("settings/personal.html", v=v, error="The pronouns you entered don't match the required format.") bare_pronouns = pronouns.lower().replace('/', '') if 'nig' in bare_pronouns: pronouns = 'BI/POC' @@ -822,7 +822,7 @@ def settings_checkmark_text(v): if not v.verified: abort(403) new_name = sanitize_settings_text(request.values.get("checkmark-text"), 100) if not new_name: abort(400) - if new_name == v.verified: return render_template("settings_personal.html", v=v, error="You didn't change anything") + if new_name == v.verified: return render_template("settings/personal.html", v=v, error="You didn't change anything") v.verified = new_name g.db.add(v) return redirect("/settings/personal") diff --git a/files/routes/users.py b/files/routes/users.py index 58fa5811a..c17260d7b 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -55,25 +55,25 @@ def upvoters_downvoters(v, username, uid, cls, vote_cls, vote_dir, template, sta @app.get("/@/upvoters//posts") @auth_required def upvoters_posts(v, username, uid): - return upvoters_downvoters(v, username, uid, Submission, Vote, 1, "voted_posts.html", None) + return upvoters_downvoters(v, username, uid, Submission, Vote, 1, "userpage/voted_posts.html", None) @app.get("/@/upvoters//comments") @auth_required def upvoters_comments(v, username, uid): - return upvoters_downvoters(v, username, uid, Comment, CommentVote, 1, "voted_comments.html", True) + return upvoters_downvoters(v, username, uid, Comment, CommentVote, 1, "userpage/voted_comments.html", True) @app.get("/@/downvoters//posts") @auth_required def downvoters_posts(v, username, uid): - return upvoters_downvoters(v, username, uid, Submission, Vote, -1, "voted_posts.html", None) + return upvoters_downvoters(v, username, uid, Submission, Vote, -1, "userpage/voted_posts.html", None) @app.get("/@/downvoters//comments") @auth_required def downvoters_comments(v, username, uid): - return upvoters_downvoters(v, username, uid, Comment, CommentVote, -1, "voted_comments.html", True) + return upvoters_downvoters(v, username, uid, Comment, CommentVote, -1, "userpage/voted_comments.html", True) def upvoting_downvoting(v, username, uid, cls, vote_cls, vote_dir, template, standalone): u = get_user(username, v=v, include_shadowbanned=False) @@ -106,25 +106,25 @@ def upvoting_downvoting(v, username, uid, cls, vote_cls, vote_dir, template, sta @app.get("/@/upvoting//posts") @auth_required def upvoting_posts(v, username, uid): - return upvoting_downvoting(v, username, uid, Submission, Vote, 1, "voted_posts.html", None) + return upvoting_downvoting(v, username, uid, Submission, Vote, 1, "userpage/voted_posts.html", None) @app.get("/@/upvoting//comments") @auth_required def upvoting_comments(v, username, uid): - return upvoting_downvoting(v, username, uid, Comment, CommentVote, 1, "voted_comments.html", True) + return upvoting_downvoting(v, username, uid, Comment, CommentVote, 1, "userpage/voted_comments.html", True) @app.get("/@/downvoting//posts") @auth_required def downvoting_posts(v, username, uid): - return upvoting_downvoting(v, username, uid, Submission, Vote, -1, "voted_posts.html", None) + return upvoting_downvoting(v, username, uid, Submission, Vote, -1, "userpage/voted_posts.html", None) @app.get("/@/downvoting//comments") @auth_required def downvoting_comments(v, username, uid): - return upvoting_downvoting(v, username, uid, Comment, CommentVote, -1, "voted_comments.html", True) + return upvoting_downvoting(v, username, uid, Comment, CommentVote, -1, "userpage/voted_comments.html", True) def user_voted(v, username, cls, vote_cls, vote_dir, template, standalone): u = get_user(username, v=v, include_shadowbanned=False) @@ -158,13 +158,13 @@ def user_voted(v, username, cls, vote_cls, vote_dir, template, standalone): @app.get("/@/upvoted/posts") @auth_required def user_upvoted_posts(v, username): - return user_voted(v, username, Submission, Vote, 1, "voted_posts.html", None) + return user_voted(v, username, Submission, Vote, 1, "userpage/voted_posts.html", None) @app.get("/@/upvoted/comments") @auth_required def user_upvoted_comments(v, username): - return user_voted(v, username, Comment, CommentVote, 1, "voted_comments.html", True) + return user_voted(v, username, Comment, CommentVote, 1, "userpage/voted_comments.html", True) @app.get("/grassed") @@ -228,7 +228,7 @@ def all_upvoters_downvoters(v, username, vote_dir, is_who_simps_hates): name2 = f'Who @{username} {simps_haters}' if is_who_simps_hates else f'@{username} biggest {simps_haters}' - return render_template("voters.html", v=v, users=users[:PAGE_SIZE], pos=pos, name=vote_name, name2=name2, total=total) + return render_template("userpage/voters.html", v=v, users=users[:PAGE_SIZE], pos=pos, name=vote_name, name2=name2, total=total) @app.get("/@/upvoters") @auth_required @@ -631,7 +631,7 @@ def followers(username, v): users = g.db.query(Follow, User).join(Follow, Follow.target_id == u.id) \ .filter(Follow.user_id == User.id) \ .order_by(Follow.created_utc).all() - return render_template("followers.html", v=v, u=u, users=users) + return render_template("userpage/followers.html", v=v, u=u, users=users) @app.get("/@/blockers") @auth_required @@ -641,7 +641,7 @@ def blockers(username, v): users = g.db.query(UserBlock, User).join(UserBlock, UserBlock.target_id == u.id) \ .filter(UserBlock.user_id == User.id) \ .order_by(UserBlock.created_utc).all() - return render_template("blockers.html", v=v, u=u, users=users) + return render_template("userpage/blockers.html", v=v, u=u, users=users) @app.get("/@/following") @auth_required @@ -653,7 +653,7 @@ def following(username, v): users = g.db.query(User).join(Follow, Follow.user_id == u.id) \ .filter(Follow.target_id == User.id) \ .order_by(Follow.created_utc).all() - return render_template("following.html", v=v, u=u, users=users) + return render_template("userpage/following.html", v=v, u=u, users=users) @app.get("/views") @auth_required @@ -661,7 +661,7 @@ def visitors(v): if not v.viewers_recorded: return render_template("errors/patron.html", v=v) viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True) - return render_template("viewers.html", v=v, viewers=viewers) + return render_template("userpage/viewers.html", v=v, viewers=viewers) @app.get("/@") @@ -687,13 +687,13 @@ def u_username(username, v=None): if not u.is_visible_to(v): if g.is_api_or_xhr or request.path.endswith(".json"): abort(403, "This userpage is private") - return render_template("userpage_private.html", u=u, v=v, is_following=is_following), 403 + return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 if v and hasattr(u, 'is_blocking') and u.is_blocking: if g.is_api_or_xhr or request.path.endswith(".json"): abort(403, f"You are blocking @{u.username}.") - return render_template("userpage_blocking.html", u=u, v=v), 403 + return render_template("userpage/blocking.html", u=u, v=v), 403 sort = request.values.get("sort", "new") @@ -756,12 +756,12 @@ def u_username_comments(username, v=None): if not u.is_visible_to(v): if g.is_api_or_xhr or request.path.endswith(".json"): abort(403, "This userpage is private") - return render_template("userpage_private.html", u=u, v=v, is_following=is_following), 403 + return render_template("userpage/private.html", u=u, v=v, is_following=is_following), 403 if v and hasattr(u, 'is_blocking') and u.is_blocking: if g.is_api_or_xhr or request.path.endswith(".json"): abort(403, f"You are blocking @{u.username}.") - return render_template("userpage_blocking.html", u=u, v=v), 403 + return render_template("userpage/blocking.html", u=u, v=v), 403 try: page = max(int(request.values.get("page", "1")), 1) except: page = 1 @@ -801,7 +801,7 @@ def u_username_comments(username, v=None): if (v and v.client) or request.path.endswith(".json"): return {"data": [c.json for c in listing]} - return render_template("userpage_comments.html", u=u, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) + return render_template("userpage/comments.html", u=u, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) @app.get("/@/info") @@ -969,7 +969,7 @@ def saved_comments(v, username): try: page = max(1, int(request.values.get("page", 1))) except: abort(400, "Invalid page input!") - return get_saves_and_subscribes(v, "userpage_comments.html", CommentSaveRelationship, page, True) + return get_saves_and_subscribes(v, "userpage/comments.html", CommentSaveRelationship, page, True) @app.get("/@/subscribed/posts") @auth_required diff --git a/files/templates/settings_advanced.html b/files/templates/settings/advanced.html similarity index 99% rename from files/templates/settings_advanced.html rename to files/templates/settings/advanced.html index 8fe475533..22487bf7a 100644 --- a/files/templates/settings_advanced.html +++ b/files/templates/settings/advanced.html @@ -1,7 +1,7 @@ {% extends "settings.html" %} {% block pagetitle %}Advanced Settings - {{SITE_NAME}}{% endblock %} {% block content %} -{% import 'settings_common.html' as common with context %} +{% import 'settings/common.html' as common with context %}
diff --git a/files/templates/settings_apps.html b/files/templates/settings/apps.html similarity index 100% rename from files/templates/settings_apps.html rename to files/templates/settings/apps.html diff --git a/files/templates/settings_common.html b/files/templates/settings/common.html similarity index 100% rename from files/templates/settings_common.html rename to files/templates/settings/common.html diff --git a/files/templates/settings_css.html b/files/templates/settings/css.html similarity index 100% rename from files/templates/settings_css.html rename to files/templates/settings/css.html diff --git a/files/templates/settings_personal.html b/files/templates/settings/personal.html similarity index 99% rename from files/templates/settings_personal.html rename to files/templates/settings/personal.html index 1705cba7b..8de9ef866 100644 --- a/files/templates/settings_personal.html +++ b/files/templates/settings/personal.html @@ -1,6 +1,6 @@ {% extends "settings.html" %} {% block pagetitle %}Personal Settings - {{SITE_NAME}}{% endblock %} -{% import 'settings_common.html' as common with context %} +{% import 'settings/common.html' as common with context %} {% block content %}