diff --git a/files/__main__.py b/files/__main__.py index 84cdef6cf..3cd73176f 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -16,9 +16,7 @@ import gevent from werkzeug.middleware.proxy_fix import ProxyFix import redis -if int(environ.get("CHRISTMAS", 0)): templates = 'templates/CHRISTMAS' -else: templates = 'templates' -app = Flask(__name__, template_folder=templates) +app = Flask(__name__, template_folder='templates') app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3) app.url_map.strict_slashes = False diff --git a/files/classes/user.py b/files/classes/user.py index b03fad73d..ddc984a21 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -42,6 +42,7 @@ class User(Base): theme = Column(String, default=defaulttheme) themecolor = Column(String, default=defaultcolor) cardview = Column(Boolean, default=cardview) + oldsite = Column(Boolean) song = Column(String) highres = Column(String) profileurl = Column(String) diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index e0318c80f..090aa3374 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -20,7 +20,9 @@ def post_embed(id, v): p = get_post(id, v, graceful=True) - return render_template("submission_listing.html", listing=[p], v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submission_listing.html", listing=[p], v=v) @app.context_processor def inject_constants(): diff --git a/files/mail/__init__.py b/files/mail/__init__.py index 36d753da8..450bd1278 100644 --- a/files/mail/__init__.py +++ b/files/mail/__init__.py @@ -61,7 +61,9 @@ def activate(v): token = request.values.get("token", "").strip() if int(time.time()) - timestamp > 3600: - return render_template("message.html", v=v, title="Verification link expired.", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", v=v, title="Verification link expired.", message="That link has expired. Visit your settings to send yourself another verification email."), 410 if not validate_hash(f"{email}+{id}+{timestamp}", token): @@ -72,7 +74,9 @@ def activate(v): abort(404) if user.is_activated and user.email == email: - return render_template("message_success.html", v=v, + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message_success.html", v=v, title="Email already verified.", message="Email already verified."), 404 user.email = email @@ -86,4 +90,6 @@ def activate(v): g.db.add(user) g.db.commit() - return render_template("message_success.html", v=v, title="Email verified.", message=f"Your email {email} has been verified. Thank you.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message_success.html", v=v, title="Email verified.", message=f"Your email {email} has been verified. Thank you.") diff --git a/files/routes/admin.py b/files/routes/admin.py index 5d222ad50..144e17e62 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -45,7 +45,9 @@ def distribute(v, cid): @admin_level_required(2) def truescore(v): users = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all() - return render_template("truescore.html", v=v, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}truescore.html", v=v, users=users) @app.post("/@/revert_actions") @limiter.limit("1/second") @@ -252,7 +254,9 @@ def post_rules(v): def shadowbanned(v): if not (v and v.admin_level > 1): abort(404) users = [x for x in g.db.query(User).filter(User.shadowbanned != None).all()] - return render_template("shadowbanned.html", v=v, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}shadowbanned.html", v=v, users=users) @app.get("/admin/agendaposters") @@ -260,7 +264,9 @@ def shadowbanned(v): def agendaposters(v): if not (v and v.admin_level > 1): abort(404) users = [x for x in g.db.query(User).filter_by(agendaposter = True).all()] - return render_template("agendaposters.html", v=v, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}agendaposters.html", v=v, users=users) @app.get("/admin/image_posts") @@ -278,7 +284,9 @@ def image_posts_listing(v): next_exists = (len(posts) > 25) posts = get_posts(posts[:25], v=v) - return render_template("admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new") @app.get("/admin/reported/posts") @@ -298,7 +306,9 @@ def reported_posts(v): listing = get_posts(listing, v=v) - return render_template("admin/reported_posts.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/reported_posts.html", next_exists=next_exists, listing=listing, page=page, v=v) @@ -320,7 +330,9 @@ def reported_comments(v): listing = get_comments(listing, v=v) - return render_template("admin/reported_comments.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/reported_comments.html", next_exists=next_exists, listing=listing, page=page, @@ -332,7 +344,9 @@ def reported_comments(v): def admin_home(v): with open('disablesignups', 'r') as f: x = f.read() - return render_template("admin/admin_home.html", v=v, x=x) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/admin_home.html", v=v, x=x) @app.post("/admin/disablesignups") @admin_level_required(2) @@ -356,7 +370,9 @@ def badge_grant_get(v): "no_user": "That user doesn't exist." } - return render_template("admin/badge_grant.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/badge_grant.html", v=v, badge_types=BADGES, error=errors.get( @@ -422,7 +438,9 @@ def users_list(v): next_exists = (len(users) > 25) users = users[:25] - return render_template("admin/new_users.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/new_users.html", v=v, users=users, next_exists=next_exists, @@ -434,7 +452,9 @@ def users_list(v): def alt_votes_get(v): if not request.values.get("u1") or not request.values.get("u2"): - return render_template("admin/alt_votes.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/alt_votes.html", v=v) u1 = request.values.get("u1") u2 = request.values.get("u2") @@ -530,7 +550,9 @@ def alt_votes_get(v): data['u2_only_comment_downs'] // len( u2_comment_downs) if u2_comment_downs else 0 - return render_template("admin/alt_votes.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/alt_votes.html", u1=u1, u2=u2, v=v, @@ -575,7 +597,9 @@ def admin_removed(v): posts = get_posts(ids, v=v) - return render_template("admin/removed_posts.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/removed_posts.html", v=v, listing=posts, page=page, @@ -599,7 +623,9 @@ def admin_removed_comments(v): comments = get_comments(ids, v=v) - return render_template("admin/removed_comments.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/removed_comments.html", v=v, listing=comments, page=page, @@ -1106,7 +1132,9 @@ def admin_dump_cache(v): def admin_banned_domains(v): banned_domains = g.db.query(BannedDomain).all() - return render_template("admin/banned_domains.html", v=v, banned_domains=banned_domains) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/banned_domains.html", v=v, banned_domains=banned_domains) @app.post("/admin/banned_domains") @limiter.limit("1/second") diff --git a/files/routes/awards.py b/files/routes/awards.py index 367f095ac..1db10fb22 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -69,7 +69,9 @@ def shop(v): val["price"] = int(val["price"]*discount) sales = g.db.query(Vote.id).count() + g.db.query(CommentVote.id).count() - g.db.query(func.sum(User.coins)).scalar() - return render_template("shop.html", awards=list(AWARDS.values()), v=v, sales=sales) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}shop.html", awards=list(AWARDS.values()), v=v, sales=sales) @app.post("/buy/") @@ -503,15 +505,21 @@ def award_comment(cid, v): @app.get("/admin/awards") @admin_level_required(2) def admin_userawards_get(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' - if v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) + if v.admin_level != 3: + return render_template(f"{template}admin/awards.html", awards=list(AWARDS3.values()), v=v) + + return render_template(f"{template}admin/awards.html", awards=list(AWARDS.values()), v=v) @app.post("/admin/awards") @limiter.limit("1/second") @admin_level_required(2) @validate_formkey def admin_userawards_post(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' try: u = request.values.get("username").strip() except: abort(404) @@ -551,5 +559,5 @@ def admin_userawards_post(v): g.db.commit() - if v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file + if v.admin_level != 3: return render_template(f"{template}admin/awards.html", awards=list(AWARDS3.values()), v=v) + return render_template(f"{template}admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index f6866813f..ecd7d447a 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -602,7 +602,9 @@ def api_comment(v): g.db.commit() if request.headers.get("Authorization"): return c.json - else: return render_template("comments.html", v=v, comments=[c]) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}comments.html", v=v, comments=[c]) @@ -684,7 +686,9 @@ def edit_comment(cid, v): if ban.reason: reason += f" {ban.reason}" if request.headers.get("Authorization"): return {'error': f'A blacklisted domain was used.'}, 400 - else: return render_template("comment_failed.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}comment_failed.html", action=f"/edit_comment/{c.id}", badlinks=[x.domain for x in bans], body=body, diff --git a/files/routes/discord.py b/files/routes/discord.py index 11d0cee76..8ae79db89 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -98,7 +98,9 @@ def discord_redirect(v): requests.delete(url, headers=headers, timeout=5) if g.db.query(User).filter(User.id!=v.id, User.discord_id==x["id"]).first(): - return render_template("message.html", title="Discord account already linked.", error="That Discord account is already in use by another user.", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Discord account already linked.", error="That Discord account is already in use by another user.", v=v) v.discord_id=x["id"] g.db.add(v) diff --git a/files/routes/front.py b/files/routes/front.py index 8700fe618..bbe8395ac 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -107,7 +107,9 @@ def notifications(v): if request.headers.get("Authorization"): return {"data":[x.json for x in listing]} - return render_template("notifications.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}notifications.html", v=v, notifications=listing, next_exists=next_exists, @@ -190,7 +192,9 @@ def front_all(v): g.db.commit() if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} - else: return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) @@ -299,7 +303,9 @@ def changelog(v): posts = get_posts(ids, v=v) if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} - else: return render_template("changelog.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}changelog.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) @cache.memoize(timeout=86400) @@ -441,4 +447,6 @@ def all_comments(v): idlist = idlist[:25] if request.headers.get("Authorization"): return {"data": [x.json for x in comments]} - else: return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file diff --git a/files/routes/login.py b/files/routes/login.py index 401d0d711..9d72ec954 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -16,7 +16,9 @@ def login_get(v): if v: return redirect(redir) - return render_template("login.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}login.html", failed=False, redirect=redir) @@ -89,19 +91,25 @@ def login_post(): if not account: time.sleep(random.uniform(0, 2)) - return render_template("login.html", failed=True) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}login.html", failed=True) if request.values.get("password"): if not account.verifyPass(request.values.get("password")): time.sleep(random.uniform(0, 2)) - return render_template("login.html", failed=True) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}login.html", failed=True) if account.mfa_secret: now = int(time.time()) hash = generate_hash(f"{account.id}+{now}+2fachallenge") - return render_template("login_2fa.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}login_2fa.html", v=account, time=now, hash=hash, @@ -121,7 +129,9 @@ def login_post(): if not account.validate_2fa(request.values.get("2fa_token", "").strip()): hash = generate_hash(f"{account.id}+{time}+2fachallenge") - return render_template("login_2fa.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}login_2fa.html", v=account, time=now, hash=hash, @@ -187,7 +197,9 @@ def sign_up_get(v): ref_user = None if ref_user and (ref_user.id in session.get("history", [])): - return render_template("sign_up_failed_ref.html") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}sign_up_failed_ref.html") now = int(time.time()) token = token_hex(16) @@ -204,7 +216,9 @@ def sign_up_get(v): error = request.values.get("error", None) - return render_template("sign_up.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}sign_up.html", formkey=formkey, now=now, redirect=redir, @@ -363,7 +377,9 @@ def sign_up_post(v): @app.get("/forgot") def get_forgot(): - return render_template("forgot_password.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}forgot_password.html", ) @@ -401,7 +417,9 @@ def post_forgot(): v=user) ) - return render_template("forgot_password.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}forgot_password.html", msg="If the username and email matches an account, you will be sent a password reset email. You have ten minutes to complete the password reset process.") @@ -415,7 +433,9 @@ def get_reset(): now = int(time.time()) if now - timestamp > 600: - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Password reset link expired", error="That password reset link has expired.") @@ -429,7 +449,9 @@ def get_reset(): reset_token = generate_hash(f"{user.id}+{timestamp}+reset+{user.login_nonce}") - return render_template("reset_password.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}reset_password.html", v=user, token=reset_token, time=timestamp, @@ -454,7 +476,9 @@ def post_reset(v): now = int(time.time()) if now - timestamp > 600: - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Password reset expired", error="That password reset form has expired.") @@ -466,7 +490,9 @@ def post_reset(v): abort(404) if not password == confirm_password: - return render_template("reset_password.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}reset_password.html", v=user, token=token, time=timestamp, @@ -477,7 +503,9 @@ def post_reset(v): g.db.commit() - return render_template("message_success.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message_success.html", title="Password reset successful!", message="Login normally to access your account.") @@ -498,7 +526,9 @@ def request_2fa_disable(): username=request.values.get("username") user=get_user(username, graceful=True) if not user or not user.email or not user.mfa_secret: - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") @@ -510,14 +540,18 @@ def request_2fa_disable(): email=email.replace('.','').replace('_','') email=f"{email}@gmail.com" if email != user.email: - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") password =request.values.get("password") if not user.verifyPass(password): - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") @@ -533,7 +567,9 @@ def request_2fa_disable(): v=user) ) - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Removal request received", message="If username, password, and email match, we will send you an email.") @@ -544,7 +580,9 @@ def reset_2fa(): t=int(request.values.get("t")) if now > t+3600*24: - return render_template("message.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message.html", title="Expired Link", error="That link has expired.") @@ -562,6 +600,8 @@ def reset_2fa(): g.db.commit() - return render_template("message_success.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}message_success.html", title="Two-factor authentication removed.", message="Login normally to access your account.") diff --git a/files/routes/oauth.py b/files/routes/oauth.py index ef7edb4d1..cf37f208d 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -13,7 +13,9 @@ def authorize_prompt(v): client_id = request.values.get("client_id") application = g.db.query(OauthApp).filter_by(client_id=client_id).first() if not application: return {"oauth_error": "Invalid `client_id`"}, 401 - return render_template("oauth.html", v=v, application=application) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}oauth.html", v=v, application=application) @app.post("/authorize") @@ -206,7 +208,9 @@ def admin_app_id(v, aid): posts=get_posts(pids, v=v) - return render_template("admin/app.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/app.html", v=v, app=oauth, listing=posts, @@ -233,7 +237,9 @@ def admin_app_id_comments(v, aid): comments=get_comments(cids, v=v) - return render_template("admin/app.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/app.html", v=v, app=oauth, comments=comments, @@ -248,7 +254,9 @@ def admin_apps_list(v): apps = g.db.query(OauthApp).all() - return render_template("admin/apps.html", v=v, apps=apps) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/apps.html", v=v, apps=apps) @app.post("/oauth/reroll/") diff --git a/files/routes/posts.py b/files/routes/posts.py index c203c6f8e..64af06f3f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -81,7 +81,9 @@ def publish(pid, v): @auth_required def submit_get(v): - return render_template("submit.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v) @app.get("/post/") @@ -214,7 +216,9 @@ def post_id(pid, anything=None, v=None): g.db.add(post) if request.host != 'old.rdrama.net' and post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()): if request.headers.get("Authorization"): return {"error":"Must be 18+ to view"}, 451 - else: return render_template("errors/nsfw.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}errors/nsfw.html", v=v) g.db.commit() if request.headers.get("Authorization"): return post.json @@ -320,7 +324,9 @@ def viewmore(v, pid, sort, offset): if len(comments) == len(comments2): offset = None comments = comments2 - return render_template("comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset) @app.post("/morecomments/") @@ -365,7 +371,9 @@ def morecomments(v, cid): c = g.db.query(Comment).filter_by(id=cid).first() comments = c.replies - return render_template("comments.html", v=v, comments=comments, render_replies=True) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True) @app.post("/edit_post/") @limiter.limit("1/second") @@ -778,7 +786,9 @@ def submit_post(v): domain_obj = get_domain(domain) if domain_obj: if request.headers.get("Authorization"): return {"error":domain_obj.reason}, 400 - else: return render_template("submit.html", v=v, error=domain_obj.reason, title=title, url=url, body=request.values.get("body", "")), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error=domain_obj.reason, title=title, url=url, body=request.values.get("body", "")), 400 elif "twitter.com" == domain: try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"] except: embed = None @@ -799,11 +809,15 @@ def submit_post(v): if not url and not request.values.get("body") and not request.files.get("file", None): if request.headers.get("Authorization"): return {"error": "`url` or `body` parameter required."}, 400 - else: return render_template("submit.html", v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400 if not title: if request.headers.get("Authorization"): return {"error": "Please enter a better title"}, 400 - else: return render_template("submit.html", v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400 elif len(title) > 500: @@ -893,12 +907,16 @@ def submit_post(v): if len(str(body)) > 10000: if request.headers.get("Authorization"): return {"error":"10000 character limit for text body."}, 400 - else: return render_template("submit.html", v=v, error="10000 character limit for text body.", title=title, url=url, body=request.values.get("body", "")), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error="10000 character limit for text body.", title=title, url=url, body=request.values.get("body", "")), 400 if len(url) > 2048: if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400 - else: return render_template("submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400 for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') @@ -933,7 +951,9 @@ def submit_post(v): body += f"\n\n{url}" else: if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 - else: return render_template("submit.html", v=v, error=f"Image/Video files only."), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error=f"Image/Video files only."), 400 body_html = sanitize(CustomRenderer().render(mistletoe.Document(body))) @@ -952,7 +972,9 @@ def submit_post(v): reason = f"Remove the {ban.domain} link from your post and try again." if ban.reason: reason += f" {ban.reason}" if request.headers.get("Authorization"): return {"error": reason}, 403 - else: return render_template("submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403 if not v.club_banned: club = bool(request.values.get("club","")) else: club = False @@ -1012,7 +1034,9 @@ def submit_post(v): if not file.content_type.startswith(('image/', 'video/')): if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400 - else: return render_template("submit.html", v=v, error=f"File type not allowed.", title=title, body=request.values.get("body", "")), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}submit.html", v=v, error=f"File type not allowed.", title=title, body=request.values.get("body", "")), 400 if file.content_type.startswith('image/'): name = f'/images/{time.time()}'.replace('.','')[:-5] + '.webp' diff --git a/files/routes/search.py b/files/routes/search.py index 15add89ab..95c27bf62 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -161,7 +161,9 @@ def searchposts(v): domain_obj=None if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in posts]} - else: return render_template("search.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}search.html", v=v, query=query, total=total, @@ -250,7 +252,9 @@ def searchcomments(v): comments = get_comments(ids, v=v) if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in comments]} - else: return render_template("search_comments.html", v=v, query=query, total=total, page=page, comments=comments, sort=sort, t=t, next_exists=next_exists) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}search_comments.html", v=v, query=query, total=total, page=page, comments=comments, sort=sort, t=t, next_exists=next_exists) @app.get("/search/users") @@ -279,4 +283,6 @@ def searchusers(v): if request.headers.get("Authorization"): return [x.json for x in users] - else: return render_template("search_users.html", v=v, query=query, total=total, page=page, users=users, sort=sort, t=t, next_exists=next_exists) \ No newline at end of file + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}search_users.html", v=v, query=query, total=total, page=page, users=users, sort=sort, t=t, next_exists=next_exists) \ No newline at end of file diff --git a/files/routes/settings.py b/files/routes/settings.py index a272cf50b..6a587b4de 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -89,6 +89,10 @@ def settings_profile_post(v): updated = True v.oldreddit = request.values.get("oldreddit", None) == 'true' + elif request.values.get("oldsite", v.oldsite) != v.oldsite: + updated = True + v.oldsite = request.values.get("oldsite", None) == 'true' + elif request.values.get("teddit", v.teddit) != v.teddit: updated = True v.teddit = request.values.get("teddit", None) == 'true' @@ -122,28 +126,36 @@ def settings_profile_post(v): v.bio_html = None g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, msg="Your bio has been updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your bio has been updated.") elif request.values.get("sig") == "": v.sig = None v.sig_html = None g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, msg="Your sig has been updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your sig has been updated.") elif request.values.get("friends") == "": v.friends = None v.friends_html = None g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, msg="Your friends list has been updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your friends list has been updated.") elif request.values.get("enemies") == "": v.enemies = None v.enemies_html = None g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, msg="Your enemies list has been updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your enemies list has been updated.") elif (v.patron or v.id == 1904) and request.values.get("sig"): sig = request.values.get("sig")[:200] @@ -165,7 +177,9 @@ def settings_profile_post(v): return {"error": reason}, 401 if len(sig_html) > 1000: - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error="Your sig is too long") @@ -173,7 +187,9 @@ def settings_profile_post(v): v.sig_html=sig_html g.db.add(v) g.db.commit() - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your sig has been updated.") @@ -197,7 +213,9 @@ def settings_profile_post(v): return {"error": reason}, 401 if len(friends_html) > 2000: - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error="Your friends list is too long") @@ -216,7 +234,9 @@ def settings_profile_post(v): v.friends_html=friends_html g.db.add(v) g.db.commit() - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your friends list has been updated.") @@ -238,7 +258,9 @@ def settings_profile_post(v): return {"error": reason}, 401 if len(enemies_html) > 2000: - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error="Your enemies list is too long") @@ -258,7 +280,9 @@ def settings_profile_post(v): v.enemies_html=enemies_html g.db.add(v) g.db.commit() - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your enemies list has been updated.") @@ -283,14 +307,18 @@ def settings_profile_post(v): bio += f"\n\n{url}" else: if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 - else: return render_template("settings_profile.html", v=v, error=f"Image/Video files only."), 400 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Image/Video files only."), 400 bio_html = CustomRenderer().render(mistletoe.Document(bio)) bio_html = sanitize(bio_html) bans = filter_comment_html(bio_html) if len(bio_html) > 10000: - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error="Your bio is too long") @@ -319,7 +347,9 @@ def settings_profile_post(v): v.bio_html=bio_html g.db.add(v) g.db.commit() - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Your bio has been updated.") @@ -409,12 +439,17 @@ def settings_profile_post(v): def filters(v): filters=request.values.get("filters")[:1000].strip() - if filters == v.custom_filter_list: return render_template("settings_filters.html", v=v, error="You didn't change anything") + if filters == v.custom_filter_list: + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_filters.html", v=v, error="You didn't change anything") v.custom_filter_list=filters g.db.add(v) g.db.commit() - return render_template("settings_filters.html", v=v, msg="Your custom filters have been updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_filters.html", v=v, msg="Your custom filters have been updated.") @app.post("/changelogsub") @auth_required @@ -434,9 +469,12 @@ def changelogsub(v): @auth_required @validate_formkey def namecolor(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + color = str(request.values.get("color", "")).strip() if color.startswith('#'): color = color[1:] - if len(color) != 6: return render_template("settings_security.html", v=v, error="Invalid color code") + if len(color) != 6: return render_template(f"{template}settings_security.html", v=v, error="Invalid color code") v.namecolor = color g.db.add(v) g.db.commit() @@ -447,9 +485,12 @@ def namecolor(v): @auth_required @validate_formkey def themecolor(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + themecolor = str(request.values.get("themecolor", "")).strip() if themecolor.startswith('#'): themecolor = themecolor[1:] - if len(themecolor) != 6: return render_template("settings_security.html", v=v, error="Invalid color code") + if len(themecolor) != 6: return render_template(f"{template}settings_security.html", v=v, error="Invalid color code") v.themecolor = themecolor g.db.add(v) g.db.commit() @@ -520,9 +561,12 @@ def gumroad(v): @auth_required @validate_formkey def titlecolor(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + titlecolor = str(request.values.get("titlecolor", "")).strip() if titlecolor.startswith('#'): titlecolor = titlecolor[1:] - if len(titlecolor) != 6: return render_template("settings_profile.html", v=v, error="Invalid color code") + if len(titlecolor) != 6: return render_template(f"{template}settings_profile.html", v=v, error="Invalid color code") v.titlecolor = titlecolor g.db.add(v) g.db.commit() @@ -533,9 +577,12 @@ def titlecolor(v): @auth_required @validate_formkey def verifiedcolor(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + verifiedcolor = str(request.values.get("verifiedcolor", "")).strip() if verifiedcolor.startswith('#'): verifiedcolor = verifiedcolor[1:] - if len(verifiedcolor) != 6: return render_template("settings_profile.html", v=v, error="Invalid color code") + if len(verifiedcolor) != 6: return render_template(f"{template}settings_profile.html", v=v, error="Invalid color code") v.verifiedcolor = verifiedcolor g.db.add(v) g.db.commit() @@ -662,7 +709,9 @@ 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 + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_security.html", v=v, error="Incorrect Password"), 401 v.login_nonce += 1 @@ -672,7 +721,9 @@ def settings_log_out_others(v): g.db.commit() - return render_template("settings_security.html", v=v, msg="All other devices have been logged out") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_security.html", v=v, msg="All other devices have been logged out") @app.post("/settings/images/profile") @@ -708,7 +759,9 @@ def settings_images_profile(v): g.db.commit() - return render_template("settings_profile.html", v=v, msg="Profile picture successfully updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Profile picture successfully updated.") @app.post("/settings/images/banner") @@ -734,7 +787,9 @@ def settings_images_banner(v): g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, msg="Banner successfully updated.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully updated.") @app.post("/settings/delete/profile") @@ -748,7 +803,9 @@ def settings_delete_profile(v): g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Profile picture successfully removed.") @app.post("/settings/delete/banner") @@ -762,20 +819,26 @@ def settings_delete_banner(v): g.db.add(v) g.db.commit() - return render_template("settings_profile.html", v=v, msg="Banner successfully removed.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully removed.") @app.get("/settings/blocks") @auth_required def settings_blockedpage(v): - return render_template("settings_blocks.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_blocks.html", v=v) @app.get("/settings/css") @auth_required def settings_css_get(v): - return render_template("settings_css.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_css.html", v=v) @app.post("/settings/css") @limiter.limit("1/second") @@ -788,14 +851,18 @@ def settings_css(v): g.db.add(v) g.db.commit() - return render_template("settings_css.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_css.html", v=v) @app.get("/settings/profilecss") @auth_required def settings_profilecss_get(v): if v.truecoins < 1000 and not v.patron and v.admin_level == 0 : return f"You must have +1000 {COINS_NAME} or be a paypig to set profile css." - return render_template("settings_profilecss.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profilecss.html", v=v) @app.post("/settings/profilecss") @limiter.limit("1/second") @@ -808,7 +875,9 @@ def settings_profilecss(v): g.db.add(v) g.db.commit() - return render_template("settings_profilecss.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profilecss.html", v=v) @app.post("/settings/block") @limiter.limit("1/second") @@ -876,7 +945,9 @@ def settings_unblock_user(v): @auth_required def settings_apps(v): - return render_template("settings_apps.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_apps.html", v=v) @app.post("/settings/remove_discord") @@ -898,7 +969,9 @@ def settings_remove_discord(v): @auth_required def settings_content_get(v): - return render_template("settings_filters.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_filters.html", v=v) @app.post("/settings/name_change") @limiter.limit("1/second") @@ -911,12 +984,16 @@ def settings_name_change(v): new_name=request.values.get("name").strip() if new_name==v.username: - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error="You didn't change anything") if not re.match(valid_username_regex, new_name): - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"This isn't a valid username.") @@ -930,7 +1007,9 @@ def settings_name_change(v): ).first() if x and x.id != v.id: - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Username `{new_name}` is already in use.") @@ -966,7 +1045,9 @@ def settings_song_change(v): id = song.split("v=")[1] elif song.startswith("https://youtu.be/"): id = song.split("https://youtu.be/")[1] - else: return render_template("settings_profile.html", v=v, error=f"Not a youtube link.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Not a youtube link.") if "?" in id: id = id.split("?")[0] if "&" in id: id = id.split("&")[0] @@ -981,15 +1062,21 @@ 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_profile.html", v=v, error=f"Can't use a live youtube video!") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Can't use a live youtube video!") if "H" in duration: - return render_template("settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") if "M" in duration: duration = int(duration.split("PT")[1].split("M")[0]) if duration > 10: - return render_template("settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") if v.song and path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User.id).filter_by(song=v.song).count() == 1: @@ -1009,7 +1096,9 @@ def settings_song_change(v): try: ydl.download([f"https://youtube.com/watch?v={id}"]) except Exception as e: print(e) - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v, error=f"Age-restricted videos aren't allowed.") @@ -1030,12 +1119,14 @@ def settings_song_change(v): @auth_required @validate_formkey def settings_title_change(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' if v.flairchanged: abort(403) new_name=request.values.get("title").strip()[:100].replace("𒐪","") - if new_name==v.customtitle: return render_template("settings_profile.html", v=v, error="You didn't change anything") + if new_name==v.customtitle: return render_template(f"{template}settings_profile.html", v=v, error="You didn't change anything") v.customtitleplain = new_name diff --git a/files/routes/static.py b/files/routes/static.py index 16cba5f80..fa046c87d 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -16,7 +16,9 @@ site_name = environ.get("SITE_NAME").strip() @auth_desired def emojis(v): emojis = (x.replace('.webp','') for x in os.listdir("files/assets/images/emojis")) - return render_template("emojis.html", v=v, emojis=emojis) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}emojis.html", v=v, emojis=emojis) @app.get('/rules') @auth_desired @@ -68,7 +70,9 @@ def participation_stats(v): } - return render_template("admin/content_stats.html", v=v, title="Content Statistics", data=data) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admin/content_stats.html", v=v, title="Content Statistics", data=data) @app.get("/chart") @@ -157,14 +161,18 @@ def cached_chart(days): def patrons(v): users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc(), User.id).all() - return render_template("patrons.html", v=v, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}patrons.html", v=v, users=users) @app.get("/admins") @app.get("/badmins") @auth_desired def admins(v): admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all() - return render_template("admins.html", v=v, admins=admins) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}admins.html", v=v, admins=admins) @app.get("/log") @@ -197,7 +205,9 @@ def log(v): admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level > 1).all()] - return render_template("log.html", v=v, admins=admins, types=types, admin=admin, type=kind, actions=actions, next_exists=next_exists, page=page) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}log.html", v=v, admins=admins, types=types, admin=admin, type=kind, actions=actions, next_exists=next_exists, page=page) @app.get("/log/") @auth_desired @@ -221,7 +231,9 @@ def log_item(id, v): if v and v.admin_level > 1: types = ACTIONTYPES else: types = ACTIONTYPES2 - return render_template("log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types) @app.get("/assets/favicon.ico") def favicon(): @@ -230,7 +242,9 @@ def favicon(): @app.get("/api") @auth_desired def api(v): - return render_template("api.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}api.html", v=v) @app.get("/contact") @app.get("/press") @@ -238,7 +252,9 @@ def api(v): @auth_required def contact(v): - return render_template("contact.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}contact.html", v=v) @app.post("/contact") @limiter.limit("1/second") @@ -248,7 +264,9 @@ def submit_contact(v): message = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + request.values.get("message", "") send_admin(v.id, message) g.db.commit() - return render_template("contact.html", v=v, msg="Your message has been sent.") + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}contact.html", v=v, msg="Your message has been sent.") @app.get('/archives') def archivesindex(): @@ -318,13 +336,17 @@ def settings(v): def settings_profile(v): - return render_template("settings_profile.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_profile.html", v=v) @app.get("/badges") @auth_desired def badges(v): - return render_template("badges.html", v=v, badges=BADGES) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}badges.html", v=v, badges=BADGES) @app.get("/blocks") @auth_desired @@ -338,20 +360,26 @@ def blocks(v): users.append(get_account(x.user_id)) targets.append(get_account(x.target_id)) - return render_template("blocks.html", v=v, users=users, targets=targets) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}blocks.html", v=v, users=users, targets=targets) @app.get("/banned") @auth_desired def banned(v): users = [x for x in g.db.query(User).filter(User.is_banned > 0, User.unban_utc == 0).all()] - return render_template("banned.html", v=v, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}banned.html", v=v, users=users) @app.get("/formatting") @auth_desired def formatting(v): - return render_template("formatting.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}formatting.html", v=v) @app.get("/service-worker.js") def serviceworker(): @@ -362,7 +390,9 @@ def serviceworker(): def settings_security(v): - return render_template("settings_security.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}settings_security.html", v=v, mfa_secret=pyotp.random_base32() if not v.mfa_secret else None, error=request.values.get("error") or None, diff --git a/files/routes/users.py b/files/routes/users.py index 71b6e132d..9afc5111d 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -35,7 +35,9 @@ def upvoters(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - return render_template("voters.html", v=v, users=users, name='Up', name2=f'@{username} biggest simps') + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'@{username} biggest simps') @app.get("/@/downvoters") @auth_desired @@ -54,7 +56,9 @@ def downvoters(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - return render_template("voters.html", v=v, users=users, name='Down', name2=f'@{username} biggest haters') + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'@{username} biggest haters') @app.get("/@/upvoting") @auth_desired @@ -73,7 +77,9 @@ def upvoting(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - return render_template("voters.html", v=v, users=users, name='Up', name2=f'Who @{username} simps for') + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'Who @{username} simps for') @app.get("/@/downvoting") @auth_desired @@ -92,7 +98,9 @@ def downvoting(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - return render_template("voters.html", v=v, users=users, name='Down', name2=f'Who @{username} hates') + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'Who @{username} hates') @app.post("/pay_rent") @limiter.limit("1/second") @@ -154,7 +162,9 @@ def steal(v): @auth_desired def rentoids(v): users = g.db.query(User).filter(User.rent_utc > 0).all() - return render_template("rentoids.html", v=v, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}rentoids.html", v=v, users=users) @app.get("/thiefs") @@ -163,7 +173,9 @@ def thiefs(v): successful = g.db.query(User).filter(User.steal_utc > 0).all() failed = g.db.query(User).filter(User.fail_utc > 0).all() failed2 = g.db.query(User).filter(User.fail2_utc > 0).all() - return render_template("thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2) @app.post("/@/suicide") @@ -275,8 +287,12 @@ def leaderboard(v): if 'pcmemes.net' == request.host: users6 = users.order_by(User.basedcount.desc()).limit(10).all() - return render_template("leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9) - return render_template("leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users7=users7, users9=users9) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users7=users7, users9=users9) @app.get("/@/css") @@ -437,7 +453,9 @@ def messagereply(v): g.db.commit() - return render_template("comments.html", v=v, comments=[new_comment]) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}comments.html", v=v, comments=[new_comment]) @app.get("/2faqr/") @auth_required @@ -496,7 +514,9 @@ def followers(username, v): # if 'rdrama.net' in request.host and u.id == 147: abort(404) ids = [x[0] for x in g.db.query(Follow.user_id).filter_by(target_id=u.id).all()] users = g.db.query(User).filter(User.id.in_(ids)).all() - return render_template("followers.html", v=v, u=u, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}followers.html", v=v, u=u, users=users) @app.get("/@/following") @auth_required @@ -505,14 +525,21 @@ def following(username, v): # if 'rdrama.net' in request.host and u.id == 147: abort(404) ids = [x[0] for x in g.db.query(Follow.target_id).filter_by(user_id=u.id).all()] users = g.db.query(User).filter(User.id.in_(ids)).all() - return render_template("following.html", v=v, u=u, users=users) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}following.html", v=v, u=u, users=users) @app.get("/views") @auth_required def visitors(v): - if 'rdrama.net' in request.host and v.admin_level < 1 and not v.patron: return render_template("errors/patron.html", v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + + if 'rdrama.net' in request.host and v.admin_level < 1 and not v.patron: return render_template(f"{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) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}viewers.html", v=v, viewers=viewers) @app.get("/@") @@ -535,7 +562,9 @@ def u_username(username, v=None): if u.reserved: if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"} - else: return render_template("userpage_reserved.html", u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_reserved.html", u=u, v=v) if v and u.id != v.id: view = g.db.query(ViewerRelationship).filter( @@ -560,20 +589,28 @@ def u_username(username, v=None): if v and u.id == LLM_ID: if int(time.time()) - v.rent_utc > 600: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) else: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) if v and hasattr(u, 'is_blocking') and u.is_blocking: if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."} - else: return render_template("userpage_blocking.html", u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_blocking.html", u=u, v=v) if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: if request.headers.get("Authorization"): return {"error": "This person is blocking you."} - else: return render_template("userpage_blocked.html", u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_blocked.html", u=u, v=v) sort = request.values.get("sort", "new") @@ -597,7 +634,9 @@ def u_username(username, v=None): if u.unban_utc: if request.headers.get("Authorization"): {"data": [x.json for x in listing]} - else: return render_template("userpage.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage.html", unban=u.unban_string, u=u, v=v, @@ -611,7 +650,9 @@ def u_username(username, v=None): if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} - else: return render_template("userpage.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage.html", u=u, v=v, listing=listing, @@ -643,7 +684,9 @@ def u_username_comments(username, v=None): if u.reserved: if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"} - else: return render_template("userpage_reserved.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_reserved.html", u=u, v=v) @@ -652,18 +695,26 @@ def u_username_comments(username, v=None): if v and u.id == LLM_ID: if int(time.time()) - v.rent_utc > 600: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) else: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) if v and hasattr(u, 'is_blocking') and u.is_blocking: if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."} - else: return render_template("userpage_blocking.html", u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_blocking.html", u=u, v=v) if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: if request.headers.get("Authorization"): return {"error": "This person is blocking you."} - else: return render_template("userpage_blocked.html", u=u, v=v) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_blocked.html", u=u, v=v) page = int(request.values.get("page", "1")) @@ -714,7 +765,9 @@ def u_username_comments(username, v=None): is_following = (v and user.has_follower(v)) if request.headers.get("Authorization"): return {"data": [c.json for c in listing]} - else: return render_template("userpage_comments.html", u=user, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_comments.html", u=user, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) @app.get("/@/info") @@ -840,7 +893,9 @@ def saved_posts(v, username): listing = get_posts(ids, v=v) if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} - else: return render_template("userpage.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage.html", u=v, v=v, listing=listing, @@ -868,7 +923,9 @@ def saved_comments(v, username): if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} - else: return render_template("userpage_comments.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}userpage_comments.html", u=v, v=v, listing=listing, diff --git a/files/routes/votes.py b/files/routes/votes.py index 877ecd9aa..3eece9126 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -15,11 +15,13 @@ defaultcolor = environ.get("DEFAULT_COLOR").strip() @limiter.limit("5/second;60/minute;200/hour") @auth_desired def admin_vote_info_get(v): + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' if v and v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500 link = request.values.get("link") - if not link: return render_template("votes.html", v=v) + if not link: return render_template(f"{template}votes.html", v=v) try: if "t2_" in link: thing = get_post(int(link.split("t2_")[1]), v=v) @@ -55,7 +57,9 @@ def admin_vote_info_get(v): else: abort(400) - return render_template("votes.html", + if v and v.oldsite: template = '' + else: template = 'CHRISTMAS/' + return render_template(f"{template}votes.html", v=v, thing=thing, ups=ups, diff --git a/files/templates/CHRISTMAS/admin/admin_home.html b/files/templates/CHRISTMAS/admin/admin_home.html index dfb3e5f92..ffff55435 100644 --- a/files/templates/CHRISTMAS/admin/admin_home.html +++ b/files/templates/CHRISTMAS/admin/admin_home.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} {{'SITE_NAME' | app_config}} diff --git a/files/templates/CHRISTMAS/admin/alt_votes.html b/files/templates/CHRISTMAS/admin/alt_votes.html index b448bce5b..3e54a2ff9 100644 --- a/files/templates/CHRISTMAS/admin/alt_votes.html +++ b/files/templates/CHRISTMAS/admin/alt_votes.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} {{'SITE_NAME' | app_config}} diff --git a/files/templates/CHRISTMAS/admin/app.html b/files/templates/CHRISTMAS/admin/app.html index f53e048f3..0f7e8136f 100644 --- a/files/templates/CHRISTMAS/admin/app.html +++ b/files/templates/CHRISTMAS/admin/app.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} API App Administration @@ -43,9 +43,9 @@ {% if listing %} - {% include "submission_listing.html" %} + {% include "CHRISTMAS/submission_listing.html" %} {% elif comments %} - {% include "comments.html" %} + {% include "CHRISTMAS/comments.html" %} {% endif %} diff --git a/files/templates/CHRISTMAS/admin/apps.html b/files/templates/CHRISTMAS/admin/apps.html index 9b1202f32..c9f963a3d 100644 --- a/files/templates/CHRISTMAS/admin/apps.html +++ b/files/templates/CHRISTMAS/admin/apps.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} API App Administration diff --git a/files/templates/CHRISTMAS/admin/awards.html b/files/templates/CHRISTMAS/admin/awards.html index e4606f753..847eb6fdb 100644 --- a/files/templates/CHRISTMAS/admin/awards.html +++ b/files/templates/CHRISTMAS/admin/awards.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} Grant User Award diff --git a/files/templates/CHRISTMAS/admin/badge_grant.html b/files/templates/CHRISTMAS/admin/badge_grant.html index 92707257e..713c55db9 100644 --- a/files/templates/CHRISTMAS/admin/badge_grant.html +++ b/files/templates/CHRISTMAS/admin/badge_grant.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} Badge Grant diff --git a/files/templates/CHRISTMAS/admin/banned_domains.html b/files/templates/CHRISTMAS/admin/banned_domains.html index dc931c16b..f580fd890 100644 --- a/files/templates/CHRISTMAS/admin/banned_domains.html +++ b/files/templates/CHRISTMAS/admin/banned_domains.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} Banned Domains diff --git a/files/templates/CHRISTMAS/admin/content_stats.html b/files/templates/CHRISTMAS/admin/content_stats.html index 4485750c2..9e7de0208 100644 --- a/files/templates/CHRISTMAS/admin/content_stats.html +++ b/files/templates/CHRISTMAS/admin/content_stats.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} {{'SITE_NAME' | app_config}} diff --git a/files/templates/CHRISTMAS/admin/image_posts.html b/files/templates/CHRISTMAS/admin/image_posts.html index 7a3feb461..a26e5feb9 100644 --- a/files/templates/CHRISTMAS/admin/image_posts.html +++ b/files/templates/CHRISTMAS/admin/image_posts.html @@ -1,4 +1,4 @@ -{% extends "userpage.html" %} +{% extends "CHRISTMAS/userpage.html" %} {% block adminpanel %}{% endblock %} {% block pagetype %}userpage{% endblock %} @@ -27,7 +27,7 @@ {% block listing %}
- {% include "submission_listing.html" %} + {% include "CHRISTMAS/submission_listing.html" %}
{% endblock %} diff --git a/files/templates/CHRISTMAS/admin/new_users.html b/files/templates/CHRISTMAS/admin/new_users.html index f20a160cd..c4ab5a602 100644 --- a/files/templates/CHRISTMAS/admin/new_users.html +++ b/files/templates/CHRISTMAS/admin/new_users.html @@ -1,9 +1,9 @@ -{% extends "mine.html" %} +{% extends "CHRISTMAS/mine.html" %} {% block maincontent %} -{% include "user_listing.html" %} +{% include "CHRISTMAS/user_listing.html" %} {% endblock %} {% block navbar %}{% endblock %} \ No newline at end of file diff --git a/files/templates/CHRISTMAS/admin/removed_comments.html b/files/templates/CHRISTMAS/admin/removed_comments.html index afe9ad9aa..4989b2329 100644 --- a/files/templates/CHRISTMAS/admin/removed_comments.html +++ b/files/templates/CHRISTMAS/admin/removed_comments.html @@ -1,4 +1,4 @@ -{% extends "admin/image_posts.html" %} +{% extends "CHRISTMAS/admin/image_posts.html" %} {% block title %} @@ -33,7 +33,7 @@
{% with comments=listing %} - {% include "comments.html" %} + {% include "CHRISTMAS/comments.html" %} {% endwith %} {% if not listing %}
diff --git a/files/templates/CHRISTMAS/admin/removed_posts.html b/files/templates/CHRISTMAS/admin/removed_posts.html index 4dbfabcbb..2a798edd5 100644 --- a/files/templates/CHRISTMAS/admin/removed_posts.html +++ b/files/templates/CHRISTMAS/admin/removed_posts.html @@ -1,4 +1,4 @@ -{% extends "admin/image_posts.html" %} +{% extends "CHRISTMAS/admin/image_posts.html" %} {% block title %} @@ -30,7 +30,7 @@ {% block listing %}
- {% include "submission_listing.html" %} + {% include "CHRISTMAS/submission_listing.html" %}
{% endblock %}
diff --git a/files/templates/CHRISTMAS/admin/reported_comments.html b/files/templates/CHRISTMAS/admin/reported_comments.html index c264aa8cf..a88b9333a 100644 --- a/files/templates/CHRISTMAS/admin/reported_comments.html +++ b/files/templates/CHRISTMAS/admin/reported_comments.html @@ -1,4 +1,4 @@ -{% extends "admin/reported_posts.html" %} +{% extends "CHRISTMAS/admin/reported_posts.html" %} @@ -7,7 +7,7 @@
{% with comments=listing %} - {% include "comments.html" %} + {% include "CHRISTMAS/comments.html" %} {% endwith %} {% if not listing %}
diff --git a/files/templates/CHRISTMAS/admin/reported_posts.html b/files/templates/CHRISTMAS/admin/reported_posts.html index b860f07ed..b840d0aec 100644 --- a/files/templates/CHRISTMAS/admin/reported_posts.html +++ b/files/templates/CHRISTMAS/admin/reported_posts.html @@ -1,4 +1,4 @@ -{% extends "userpage.html" %} +{% extends "CHRISTMAS/userpage.html" %} {% block adminpanel %}{% endblock %} {% block pagetype %}userpage{% endblock %} @@ -54,7 +54,7 @@ {% block listing %}
- {% include "submission_listing.html" %} + {% include "CHRISTMAS/submission_listing.html" %}
{% endblock %}
diff --git a/files/templates/CHRISTMAS/admin/rules.html b/files/templates/CHRISTMAS/admin/rules.html index 754f5ba69..61f20c3bc 100644 --- a/files/templates/CHRISTMAS/admin/rules.html +++ b/files/templates/CHRISTMAS/admin/rules.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block pagetitle %}Edit {{'SITE_NAME' | app_config}} rules{% endblock %} diff --git a/files/templates/CHRISTMAS/admins.html b/files/templates/CHRISTMAS/admins.html index a57b82259..5f1500677 100644 --- a/files/templates/CHRISTMAS/admins.html +++ b/files/templates/CHRISTMAS/admins.html @@ -1,4 +1,4 @@ -{% extends "settings2.html" %} +{% extends "CHRISTMAS/settings2.html" %} {% block pagetitle %}Admins{% endblock %} diff --git a/files/templates/CHRISTMAS/agendaposters.html b/files/templates/CHRISTMAS/agendaposters.html index 5a2168b70..ff3fec505 100644 --- a/files/templates/CHRISTMAS/agendaposters.html +++ b/files/templates/CHRISTMAS/agendaposters.html @@ -1,4 +1,4 @@ -{% extends "settings2.html" %} +{% extends "CHRISTMAS/settings2.html" %} {% block content %} diff --git a/files/templates/CHRISTMAS/api.html b/files/templates/CHRISTMAS/api.html index 94dee7924..738f1a4b9 100644 --- a/files/templates/CHRISTMAS/api.html +++ b/files/templates/CHRISTMAS/api.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} {{'SITE_NAME' | app_config}} - API diff --git a/files/templates/CHRISTMAS/badges.html b/files/templates/CHRISTMAS/badges.html index 9efe6b27c..09b535bf2 100644 --- a/files/templates/CHRISTMAS/badges.html +++ b/files/templates/CHRISTMAS/badges.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block content %}
 
diff --git a/files/templates/CHRISTMAS/banned.html b/files/templates/CHRISTMAS/banned.html
index 125044079..9484e578f 100644
--- a/files/templates/CHRISTMAS/banned.html
+++ b/files/templates/CHRISTMAS/banned.html
@@ -1,4 +1,4 @@
-{% extends "settings2.html" %}
+{% extends "CHRISTMAS/settings2.html" %}
 
 {% block content %}
 
diff --git a/files/templates/CHRISTMAS/blocks.html b/files/templates/CHRISTMAS/blocks.html index 74a79b441..e5b389b15 100644 --- a/files/templates/CHRISTMAS/blocks.html +++ b/files/templates/CHRISTMAS/blocks.html @@ -1,4 +1,4 @@ -{% extends "settings2.html" %} +{% extends "CHRISTMAS/settings2.html" %} {% block pagetitle %}Blocks{% endblock %} diff --git a/files/templates/CHRISTMAS/changelog.html b/files/templates/CHRISTMAS/changelog.html index afb8591c9..6ce2b2709 100644 --- a/files/templates/CHRISTMAS/changelog.html +++ b/files/templates/CHRISTMAS/changelog.html @@ -1,4 +1,4 @@ -{% extends "settings2.html" %} +{% extends "CHRISTMAS/settings2.html" %} {% block pagetitle %}Changelog{% endblock %} @@ -77,7 +77,7 @@
- {% include "submission_listing.html" %} + {% include "CHRISTMAS/submission_listing.html" %}
diff --git a/files/templates/CHRISTMAS/comment_failed.html b/files/templates/CHRISTMAS/comment_failed.html index a007675e6..dda7349d4 100644 --- a/files/templates/CHRISTMAS/comment_failed.html +++ b/files/templates/CHRISTMAS/comment_failed.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block title %} Unable to post comment diff --git a/files/templates/CHRISTMAS/comments.html b/files/templates/CHRISTMAS/comments.html index 89d4aa3df..2d3229a49 100644 --- a/files/templates/CHRISTMAS/comments.html +++ b/files/templates/CHRISTMAS/comments.html @@ -1,5 +1,5 @@ {% if v %} - {% include "award_modal.html" %} + {% include "CHRISTMAS/award_modal.html" %} {% endif %} @@ -10,7 +10,7 @@ -{% include "expanded_image_modal.html" %} +{% include "CHRISTMAS/expanded_image_modal.html" %} diff --git a/files/templates/CHRISTMAS/submission/SubmissionAwards.html b/files/templates/CHRISTMAS/submission/SubmissionAwards.html index fcdc4bb61..6043f9ac9 100644 --- a/files/templates/CHRISTMAS/submission/SubmissionAwards.html +++ b/files/templates/CHRISTMAS/submission/SubmissionAwards.html @@ -1,6 +1,6 @@ {% if p.award_count("train") %} -{% include "/awards/Christmas/Sleighs.html" %} +{% include "CHRISTMAS/awards/Christmas/Sleighs.html" %} {% endif %} @@ -39,13 +39,13 @@ {% if p.award_count("gingerbread") %} - {% include "/awards/Christmas/Gingerbread.html" %} + {% include "CHRISTMAS/awards/Christmas/Gingerbread.html" %} {% endif %} {% if p.award_count("snow") %} -{% include "/awards/Christmas/Snow.html" %} +{% include "CHRISTMAS/awards/Christmas/Snow.html" %} {% if p.award_count("snow") > 5 %}
{% endif %} @@ -143,6 +143,6 @@ {% if p.award_count("fireplace")%} - {% include "/awards/Christmas/Fireplace.html" %} + {% include "CHRISTMAS/awards/Christmas/Fireplace.html" %} {% endif %} diff --git a/files/templates/CHRISTMAS/submission_banned.html b/files/templates/CHRISTMAS/submission_banned.html index 420c5cf01..6bad082bc 100644 --- a/files/templates/CHRISTMAS/submission_banned.html +++ b/files/templates/CHRISTMAS/submission_banned.html @@ -1,4 +1,4 @@ -{% extends "submission.html" %} +{% extends "CHRISTMAS/submission.html" %} {% set score=p.score %} {% if v %} @@ -99,7 +99,7 @@
{% with comments=p.replies %} - {% include "comments.html" %} + {% include "CHRISTMAS/comments.html" %} {% endwith %}
diff --git a/files/templates/CHRISTMAS/submission_listing.html b/files/templates/CHRISTMAS/submission_listing.html index 726a039a5..d85d2e56b 100644 --- a/files/templates/CHRISTMAS/submission_listing.html +++ b/files/templates/CHRISTMAS/submission_listing.html @@ -1,5 +1,5 @@ {% if v %} - {% include "award_modal.html" %} + {% include "CHRISTMAS/award_modal.html" %} {% endif %} {% for p in listing %} @@ -242,7 +242,7 @@ {% endif %} @@ -273,10 +273,10 @@
- {% include "/submission/SubmissionActionsMobile.html" %} + {% include "CHRISTMAS/submission/SubmissionActionsMobile.html" %}
-{% include "/modals/ModalSubmissionActions.html" %} +{% include "CHRISTMAS/modals/ModalSubmissionActions.html" %} {% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and environ.get('CARD_VIEW') == '1')) %}
@@ -371,14 +371,14 @@ {% endfor %} {% if v %} - {% include "delete_post_modal.html" %} - {% include "report_post_modal.html" %} + {% include "CHRISTMAS/delete_post_modal.html" %} + {% include "CHRISTMAS/report_post_modal.html" %} {% if v.admin_level == 6 %} - {% include "ban_modal.html" %} + {% include "CHRISTMAS/ban_modal.html" %} {% endif %} {% endif %} -{% include "expanded_image_modal.html" %} +{% include "CHRISTMAS/expanded_image_modal.html" %} diff --git a/files/templates/CHRISTMAS/submit.html b/files/templates/CHRISTMAS/submit.html index fc3dcab7c..1bcb42abf 100644 --- a/files/templates/CHRISTMAS/submit.html +++ b/files/templates/CHRISTMAS/submit.html @@ -2,7 +2,7 @@ Create a post - {{'SITE_NAME' | app_config}} {% endblock %} -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block subHeader %}
@@ -156,13 +156,13 @@ {% endblock %} {% block sidebar %} - {% include '/sidebars/SubmitSidebar.html' %} + {% include 'CHRISTMAS//sidebars/SubmitSidebar.html' %} {% endblock %} {% block modals %} - {% include "emoji_modal.html" %} - {% include "gif_modal.html" %} - {% include '/awards/Christmas/Snow.html' %} + {% include "CHRISTMAS/emoji_modal.html" %} + {% include "CHRISTMAS/gif_modal.html" %} + {% include 'CHRISTMAS//awards/Christmas/Snow.html' %} {% endblock %} {% block scripts %} diff --git a/files/templates/CHRISTMAS/thiefs.html b/files/templates/CHRISTMAS/thiefs.html index 198ae40a1..61172c0ef 100644 --- a/files/templates/CHRISTMAS/thiefs.html +++ b/files/templates/CHRISTMAS/thiefs.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block content %}

 
Successful thiefs
diff --git a/files/templates/CHRISTMAS/truescore.html b/files/templates/CHRISTMAS/truescore.html index 89cec2269..35b500672 100644 --- a/files/templates/CHRISTMAS/truescore.html +++ b/files/templates/CHRISTMAS/truescore.html @@ -1,4 +1,4 @@ -{% extends "settings2.html" %} +{% extends "CHRISTMAS/settings2.html" %} {% block pagetitle %}Truescore Leaderboard{% endblock %} diff --git a/files/templates/CHRISTMAS/userpage.html b/files/templates/CHRISTMAS/userpage.html index cd1e40850..f7013f06b 100644 --- a/files/templates/CHRISTMAS/userpage.html +++ b/files/templates/CHRISTMAS/userpage.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block pagetype %}userpage{% endblock %} @@ -38,12 +38,12 @@
    {% if v.admin_level > 1 %}
  • - {% include '/dropdowns/ProfileAdminDropdown.html' %} + {% include 'CHRISTMAS//dropdowns/ProfileAdminDropdown.html' %}
  • {% endif %} {% if not u.is_suspended %}
  • - {% include '/dropdowns/ProfileDropdown.html' %} + {% include 'CHRISTMAS//dropdowns/ProfileDropdown.html' %}
  • {% if v.id == u.id %}
  • @@ -321,12 +321,12 @@
    {% if not "saved" in request.full_path %}
    - {% include "/dropdowns/SubmissionSorts.html" %} + {% include "CHRISTMAS/dropdowns/SubmissionSorts.html" %}
    {% endif %}
      - {% include "submission_listing.html" %} + {% include "CHRISTMAS/submission_listing.html" %}
    {% if listing %} @@ -356,17 +356,17 @@ {% endblock %} {% block sidebar %} -{% include "/sidebars/ProfileSidebar.html" %} +{% include "CHRISTMAS/sidebars/ProfileSidebar.html" %} {% endblock %} {% block modals %} {% if v %} - {% include "emoji_modal.html" %} - {% include "gif_modal.html" %} - {% include "/modals/ModalDirectMessage.html" %} - {% include "/modals/ModalGiftCoins.html" %} + {% include "CHRISTMAS/emoji_modal.html" %} + {% include "CHRISTMAS/gif_modal.html" %} + {% include "CHRISTMAS/modals/ModalDirectMessage.html" %} + {% include "CHRISTMAS/modals/ModalGiftCoins.html" %} {% if v.admin_level > 1 %} - {% include "/modals/ModalAdminManageUser.html" %} + {% include "CHRISTMAS/modals/ModalAdminManageUser.html" %} {% endif %} {% endif %} {% endblock %} diff --git a/files/templates/CHRISTMAS/userpage_blocked.html b/files/templates/CHRISTMAS/userpage_blocked.html index cff2bff09..9078eb371 100644 --- a/files/templates/CHRISTMAS/userpage_blocked.html +++ b/files/templates/CHRISTMAS/userpage_blocked.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block pagetype %}userpage{% endblock %} diff --git a/files/templates/CHRISTMAS/userpage_blocking.html b/files/templates/CHRISTMAS/userpage_blocking.html index d96072d77..2e04c2789 100644 --- a/files/templates/CHRISTMAS/userpage_blocking.html +++ b/files/templates/CHRISTMAS/userpage_blocking.html @@ -1,4 +1,4 @@ -{% extends "default.html" %} +{% extends "CHRISTMAS/default.html" %} {% block pagetype %}userpage{% endblock %} diff --git a/files/templates/CHRISTMAS/userpage_comments.html b/files/templates/CHRISTMAS/userpage_comments.html index d16c723fb..083f74a12 100644 --- a/files/templates/CHRISTMAS/userpage_comments.html +++ b/files/templates/CHRISTMAS/userpage_comments.html @@ -1,4 +1,4 @@ -{% extends "userpage.html" %} +{% extends "CHRISTMAS/userpage.html" %}