forked from rDrama/rDrama
fsfs
parent
db1bdd176e
commit
efff0400ef
|
@ -20,7 +20,7 @@ def post_embed(id, v):
|
||||||
|
|
||||||
p = get_post(id, v, graceful=True)
|
p = get_post(id, v, graceful=True)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}submission_listing.html", listing=[p], v=v)
|
return render_template(f"{template}submission_listing.html", listing=[p], v=v)
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ def activate(v):
|
||||||
token = request.values.get("token", "").strip()
|
token = request.values.get("token", "").strip()
|
||||||
|
|
||||||
if int(time.time()) - timestamp > 3600:
|
if int(time.time()) - timestamp > 3600:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}message.html", v=v, title="Verification link expired.",
|
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
|
message="That link has expired. Visit your settings to send yourself another verification email."), 410
|
||||||
|
@ -74,7 +74,7 @@ def activate(v):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
if user.is_activated and user.email == email:
|
if user.is_activated and user.email == email:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}message_success.html", v=v,
|
return render_template(f"{template}message_success.html", v=v,
|
||||||
title="Email already verified.", message="Email already verified."), 404
|
title="Email already verified.", message="Email already verified."), 404
|
||||||
|
@ -90,6 +90,6 @@ def activate(v):
|
||||||
g.db.add(user)
|
g.db.add(user)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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.")
|
return render_template(f"{template}message_success.html", v=v, title="Email verified.", message=f"Your email {email} has been verified. Thank you.")
|
||||||
|
|
|
@ -45,7 +45,7 @@ def distribute(v, cid):
|
||||||
@admin_level_required(2)
|
@admin_level_required(2)
|
||||||
def truescore(v):
|
def truescore(v):
|
||||||
users = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all()
|
users = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}truescore.html", v=v, users=users)
|
return render_template(f"{template}truescore.html", v=v, users=users)
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ def post_rules(v):
|
||||||
def shadowbanned(v):
|
def shadowbanned(v):
|
||||||
if not (v and v.admin_level > 1): abort(404)
|
if not (v and v.admin_level > 1): abort(404)
|
||||||
users = [x for x in g.db.query(User).filter(User.shadowbanned != None).all()]
|
users = [x for x in g.db.query(User).filter(User.shadowbanned != None).all()]
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}shadowbanned.html", v=v, users=users)
|
return render_template(f"{template}shadowbanned.html", v=v, users=users)
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ def shadowbanned(v):
|
||||||
def agendaposters(v):
|
def agendaposters(v):
|
||||||
if not (v and v.admin_level > 1): abort(404)
|
if not (v and v.admin_level > 1): abort(404)
|
||||||
users = [x for x in g.db.query(User).filter_by(agendaposter = True).all()]
|
users = [x for x in g.db.query(User).filter_by(agendaposter = True).all()]
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}agendaposters.html", v=v, users=users)
|
return render_template(f"{template}agendaposters.html", v=v, users=users)
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ def image_posts_listing(v):
|
||||||
next_exists = (len(posts) > 25)
|
next_exists = (len(posts) > 25)
|
||||||
posts = get_posts(posts[:25], v=v)
|
posts = get_posts(posts[:25], v=v)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new")
|
return render_template(f"{template}admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new")
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ def reported_posts(v):
|
||||||
|
|
||||||
listing = get_posts(listing, v=v)
|
listing = get_posts(listing, v=v)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/reported_posts.html",
|
return render_template(f"{template}admin/reported_posts.html",
|
||||||
next_exists=next_exists, listing=listing, page=page, v=v)
|
next_exists=next_exists, listing=listing, page=page, v=v)
|
||||||
|
@ -330,7 +330,7 @@ def reported_comments(v):
|
||||||
|
|
||||||
listing = get_comments(listing, v=v)
|
listing = get_comments(listing, v=v)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/reported_comments.html",
|
return render_template(f"{template}admin/reported_comments.html",
|
||||||
next_exists=next_exists,
|
next_exists=next_exists,
|
||||||
|
@ -344,7 +344,7 @@ def reported_comments(v):
|
||||||
def admin_home(v):
|
def admin_home(v):
|
||||||
with open('disablesignups', 'r') as f:
|
with open('disablesignups', 'r') as f:
|
||||||
x = f.read()
|
x = f.read()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/admin_home.html", v=v, x=x)
|
return render_template(f"{template}admin/admin_home.html", v=v, x=x)
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ def badge_grant_get(v):
|
||||||
"no_user": "That user doesn't exist."
|
"no_user": "That user doesn't exist."
|
||||||
}
|
}
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/badge_grant.html",
|
return render_template(f"{template}admin/badge_grant.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -438,7 +438,7 @@ def users_list(v):
|
||||||
next_exists = (len(users) > 25)
|
next_exists = (len(users) > 25)
|
||||||
users = users[:25]
|
users = users[:25]
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/new_users.html",
|
return render_template(f"{template}admin/new_users.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -452,7 +452,7 @@ def users_list(v):
|
||||||
def alt_votes_get(v):
|
def alt_votes_get(v):
|
||||||
|
|
||||||
if not request.values.get("u1") or not request.values.get("u2"):
|
if not request.values.get("u1") or not request.values.get("u2"):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/alt_votes.html", v=v)
|
return render_template(f"{template}admin/alt_votes.html", v=v)
|
||||||
|
|
||||||
|
@ -550,7 +550,7 @@ def alt_votes_get(v):
|
||||||
data['u2_only_comment_downs'] // len(
|
data['u2_only_comment_downs'] // len(
|
||||||
u2_comment_downs) if u2_comment_downs else 0
|
u2_comment_downs) if u2_comment_downs else 0
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/alt_votes.html",
|
return render_template(f"{template}admin/alt_votes.html",
|
||||||
u1=u1,
|
u1=u1,
|
||||||
|
@ -597,7 +597,7 @@ def admin_removed(v):
|
||||||
|
|
||||||
posts = get_posts(ids, v=v)
|
posts = get_posts(ids, v=v)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/removed_posts.html",
|
return render_template(f"{template}admin/removed_posts.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -623,7 +623,7 @@ def admin_removed_comments(v):
|
||||||
|
|
||||||
comments = get_comments(ids, v=v)
|
comments = get_comments(ids, v=v)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/removed_comments.html",
|
return render_template(f"{template}admin/removed_comments.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -1126,7 +1126,7 @@ def admin_dump_cache(v):
|
||||||
def admin_banned_domains(v):
|
def admin_banned_domains(v):
|
||||||
|
|
||||||
banned_domains = g.db.query(BannedDomain).all()
|
banned_domains = g.db.query(BannedDomain).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/banned_domains.html", v=v, banned_domains=banned_domains)
|
return render_template(f"{template}admin/banned_domains.html", v=v, banned_domains=banned_domains)
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ def shop(v):
|
||||||
val["price"] = int(val["price"]*discount)
|
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()
|
sales = g.db.query(Vote.id).count() + g.db.query(CommentVote.id).count() - g.db.query(func.sum(User.coins)).scalar()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}shop.html", awards=list(AWARDS.values()), v=v, sales=sales)
|
return render_template(f"{template}shop.html", awards=list(AWARDS.values()), v=v, sales=sales)
|
||||||
|
|
||||||
|
@ -505,7 +505,7 @@ def award_comment(cid, v):
|
||||||
@app.get("/admin/awards")
|
@app.get("/admin/awards")
|
||||||
@admin_level_required(2)
|
@admin_level_required(2)
|
||||||
def admin_userawards_get(v):
|
def admin_userawards_get(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
if v.admin_level != 3:
|
if v.admin_level != 3:
|
||||||
|
@ -518,7 +518,7 @@ def admin_userawards_get(v):
|
||||||
@admin_level_required(2)
|
@admin_level_required(2)
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def admin_userawards_post(v):
|
def admin_userawards_post(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
try: u = request.values.get("username").strip()
|
try: u = request.values.get("username").strip()
|
||||||
|
|
|
@ -602,7 +602,7 @@ def api_comment(v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return c.json
|
if request.headers.get("Authorization"): return c.json
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}comments.html", v=v, comments=[c])
|
return render_template(f"{template}comments.html", v=v, comments=[c])
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ def edit_comment(cid, v):
|
||||||
if ban.reason: reason += f" {ban.reason}"
|
if ban.reason: reason += f" {ban.reason}"
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {'error': f'A blacklisted domain was used.'}, 400
|
if request.headers.get("Authorization"): return {'error': f'A blacklisted domain was used.'}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}comment_failed.html",
|
return render_template(f"{template}comment_failed.html",
|
||||||
action=f"/edit_comment/{c.id}",
|
action=f"/edit_comment/{c.id}",
|
||||||
|
|
|
@ -98,7 +98,7 @@ def discord_redirect(v):
|
||||||
requests.delete(url, headers=headers, timeout=5)
|
requests.delete(url, headers=headers, timeout=5)
|
||||||
|
|
||||||
if g.db.query(User).filter(User.id!=v.id, User.discord_id==x["id"]).first():
|
if g.db.query(User).filter(User.id!=v.id, User.discord_id==x["id"]).first():
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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)
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ def notifications(v):
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data":[x.json for x in listing]}
|
if request.headers.get("Authorization"): return {"data":[x.json for x in listing]}
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}notifications.html",
|
return render_template(f"{template}notifications.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -192,7 +192,7 @@ def front_all(v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
return render_template(f"{template}home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ def changelog(v):
|
||||||
posts = get_posts(ids, v=v)
|
posts = get_posts(ids, v=v)
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}changelog.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
return render_template(f"{template}changelog.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
||||||
|
|
||||||
|
@ -447,6 +447,6 @@ def all_comments(v):
|
||||||
idlist = idlist[:25]
|
idlist = idlist[:25]
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in comments]}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in comments]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
return render_template(f"{template}home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists)
|
|
@ -16,7 +16,7 @@ def login_get(v):
|
||||||
if v:
|
if v:
|
||||||
return redirect(redir)
|
return redirect(redir)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}login.html",
|
return render_template(f"{template}login.html",
|
||||||
failed=False,
|
failed=False,
|
||||||
|
@ -190,7 +190,7 @@ def sign_up_get(v):
|
||||||
ref_user = None
|
ref_user = None
|
||||||
|
|
||||||
if ref_user and (ref_user.id in session.get("history", [])):
|
if ref_user and (ref_user.id in session.get("history", [])):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}sign_up_failed_ref.html")
|
return render_template(f"{template}sign_up_failed_ref.html")
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ def sign_up_get(v):
|
||||||
|
|
||||||
error = request.values.get("error", None)
|
error = request.values.get("error", None)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}sign_up.html",
|
return render_template(f"{template}sign_up.html",
|
||||||
formkey=formkey,
|
formkey=formkey,
|
||||||
|
@ -459,7 +459,7 @@ def post_reset(v):
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
|
|
||||||
if now - timestamp > 600:
|
if now - timestamp > 600:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}message.html",
|
return render_template(f"{template}message.html",
|
||||||
title="Password reset expired",
|
title="Password reset expired",
|
||||||
|
@ -473,7 +473,7 @@ def post_reset(v):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
if not password == confirm_password:
|
if not password == confirm_password:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}reset_password.html",
|
return render_template(f"{template}reset_password.html",
|
||||||
v=user,
|
v=user,
|
||||||
|
@ -486,7 +486,7 @@ def post_reset(v):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}message_success.html",
|
return render_template(f"{template}message_success.html",
|
||||||
title="Password reset successful!",
|
title="Password reset successful!",
|
||||||
|
|
|
@ -13,7 +13,7 @@ def authorize_prompt(v):
|
||||||
client_id = request.values.get("client_id")
|
client_id = request.values.get("client_id")
|
||||||
application = g.db.query(OauthApp).filter_by(client_id=client_id).first()
|
application = g.db.query(OauthApp).filter_by(client_id=client_id).first()
|
||||||
if not application: return {"oauth_error": "Invalid `client_id`"}, 401
|
if not application: return {"oauth_error": "Invalid `client_id`"}, 401
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}oauth.html", v=v, application=application)
|
return render_template(f"{template}oauth.html", v=v, application=application)
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ def admin_app_id(v, aid):
|
||||||
|
|
||||||
posts=get_posts(pids, v=v)
|
posts=get_posts(pids, v=v)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/app.html",
|
return render_template(f"{template}admin/app.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -237,7 +237,7 @@ def admin_app_id_comments(v, aid):
|
||||||
comments=get_comments(cids, v=v)
|
comments=get_comments(cids, v=v)
|
||||||
|
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/app.html",
|
return render_template(f"{template}admin/app.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -254,7 +254,7 @@ def admin_apps_list(v):
|
||||||
|
|
||||||
apps = g.db.query(OauthApp).all()
|
apps = g.db.query(OauthApp).all()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/apps.html", v=v, apps=apps)
|
return render_template(f"{template}admin/apps.html", v=v, apps=apps)
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ def publish(pid, v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def submit_get(v):
|
def submit_get(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}submit.html",
|
return render_template(f"{template}submit.html",
|
||||||
v=v)
|
v=v)
|
||||||
|
@ -92,7 +92,7 @@ def submit_get(v):
|
||||||
@app.get("/logged_out/post/<pid>/<anything>")
|
@app.get("/logged_out/post/<pid>/<anything>")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def post_id(pid, anything=None, v=None):
|
def post_id(pid, anything=None, v=None):
|
||||||
if v and v.oldsite: template2 = ''
|
if not v or v.oldsite: template2 = ''
|
||||||
else: template2 = 'CHRISTMAS/'
|
else: template2 = 'CHRISTMAS/'
|
||||||
|
|
||||||
if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}")
|
if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}")
|
||||||
|
@ -324,7 +324,7 @@ def viewmore(v, pid, sort, offset):
|
||||||
if len(comments) == len(comments2): offset = None
|
if len(comments) == len(comments2): offset = None
|
||||||
comments = comments2
|
comments = comments2
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset)
|
return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset)
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ def morecomments(v, cid):
|
||||||
c = g.db.query(Comment).filter_by(id=cid).first()
|
c = g.db.query(Comment).filter_by(id=cid).first()
|
||||||
comments = c.replies
|
comments = c.replies
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True)
|
return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True)
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ def submit_post(v):
|
||||||
domain_obj = get_domain(domain)
|
domain_obj = get_domain(domain)
|
||||||
if domain_obj:
|
if domain_obj:
|
||||||
if request.headers.get("Authorization"): return {"error":domain_obj.reason}, 400
|
if request.headers.get("Authorization"): return {"error":domain_obj.reason}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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
|
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:
|
elif "twitter.com" == domain:
|
||||||
|
@ -809,13 +809,13 @@ def submit_post(v):
|
||||||
|
|
||||||
if not url and not request.values.get("body") and not request.files.get("file", None):
|
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
|
if request.headers.get("Authorization"): return {"error": "`url` or `body` parameter required."}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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
|
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 not title:
|
||||||
if request.headers.get("Authorization"): return {"error": "Please enter a better title"}, 400
|
if request.headers.get("Authorization"): return {"error": "Please enter a better title"}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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
|
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
|
||||||
|
|
||||||
|
@ -907,14 +907,14 @@ def submit_post(v):
|
||||||
if len(str(body)) > 10000:
|
if len(str(body)) > 10000:
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"error":"10000 character limit for text body."}, 400
|
if request.headers.get("Authorization"): return {"error":"10000 character limit for text body."}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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
|
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 len(url) > 2048:
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400
|
if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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
|
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
|
||||||
|
|
||||||
|
@ -951,7 +951,7 @@ def submit_post(v):
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}submit.html", v=v, error=f"Image/Video files only."), 400
|
return render_template(f"{template}submit.html", v=v, error=f"Image/Video files only."), 400
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ def submit_post(v):
|
||||||
reason = f"Remove the {ban.domain} link from your post and try again."
|
reason = f"Remove the {ban.domain} link from your post and try again."
|
||||||
if ban.reason: reason += f" {ban.reason}"
|
if ban.reason: reason += f" {ban.reason}"
|
||||||
if request.headers.get("Authorization"): return {"error": reason}, 403
|
if request.headers.get("Authorization"): return {"error": reason}, 403
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403
|
return render_template(f"{template}submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ def submit_post(v):
|
||||||
|
|
||||||
if not file.content_type.startswith(('image/', 'video/')):
|
if not file.content_type.startswith(('image/', 'video/')):
|
||||||
if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400
|
if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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
|
return render_template(f"{template}submit.html", v=v, error=f"File type not allowed.", title=title, body=request.values.get("body", "")), 400
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ def searchposts(v):
|
||||||
domain_obj=None
|
domain_obj=None
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in posts]}
|
if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in posts]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}search.html",
|
return render_template(f"{template}search.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -253,7 +253,7 @@ def searchcomments(v):
|
||||||
comments = get_comments(ids, v=v)
|
comments = get_comments(ids, v=v)
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in comments]}
|
if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in comments]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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)
|
||||||
|
|
||||||
|
@ -284,6 +284,6 @@ def searchusers(v):
|
||||||
|
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return [x.json for x in users]
|
if request.headers.get("Authorization"): return [x.json for x in users]
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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)
|
|
@ -126,7 +126,7 @@ def settings_profile_post(v):
|
||||||
v.bio_html = None
|
v.bio_html = None
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Your bio has been updated.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Your bio has been updated.")
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ def settings_profile_post(v):
|
||||||
v.sig_html = None
|
v.sig_html = None
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Your sig has been updated.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Your sig has been updated.")
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ def settings_profile_post(v):
|
||||||
v.friends_html = None
|
v.friends_html = None
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Your friends list has been updated.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Your friends list has been updated.")
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ def settings_profile_post(v):
|
||||||
v.enemies_html = None
|
v.enemies_html = None
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Your enemies list has been updated.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Your enemies list has been updated.")
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ def settings_profile_post(v):
|
||||||
return {"error": reason}, 401
|
return {"error": reason}, 401
|
||||||
|
|
||||||
if len(sig_html) > 1000:
|
if len(sig_html) > 1000:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -187,7 +187,7 @@ def settings_profile_post(v):
|
||||||
v.sig_html=sig_html
|
v.sig_html=sig_html
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -213,7 +213,7 @@ def settings_profile_post(v):
|
||||||
return {"error": reason}, 401
|
return {"error": reason}, 401
|
||||||
|
|
||||||
if len(friends_html) > 2000:
|
if len(friends_html) > 2000:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -234,7 +234,7 @@ def settings_profile_post(v):
|
||||||
v.friends_html=friends_html
|
v.friends_html=friends_html
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -258,7 +258,7 @@ def settings_profile_post(v):
|
||||||
return {"error": reason}, 401
|
return {"error": reason}, 401
|
||||||
|
|
||||||
if len(enemies_html) > 2000:
|
if len(enemies_html) > 2000:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -280,7 +280,7 @@ def settings_profile_post(v):
|
||||||
v.enemies_html=enemies_html
|
v.enemies_html=enemies_html
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -307,7 +307,7 @@ def settings_profile_post(v):
|
||||||
bio += f"\n\n{url}"
|
bio += f"\n\n{url}"
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, error=f"Image/Video files only."), 400
|
return render_template(f"{template}settings_profile.html", v=v, error=f"Image/Video files only."), 400
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ def settings_profile_post(v):
|
||||||
bans = filter_comment_html(bio_html)
|
bans = filter_comment_html(bio_html)
|
||||||
|
|
||||||
if len(bio_html) > 10000:
|
if len(bio_html) > 10000:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -347,7 +347,7 @@ def settings_profile_post(v):
|
||||||
v.bio_html=bio_html
|
v.bio_html=bio_html
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -445,14 +445,14 @@ def filters(v):
|
||||||
filters=request.values.get("filters")[:1000].strip()
|
filters=request.values.get("filters")[:1000].strip()
|
||||||
|
|
||||||
if filters == v.custom_filter_list:
|
if filters == v.custom_filter_list:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_filters.html", v=v, error="You didn't change anything")
|
return render_template(f"{template}settings_filters.html", v=v, error="You didn't change anything")
|
||||||
|
|
||||||
v.custom_filter_list=filters
|
v.custom_filter_list=filters
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_filters.html", v=v, msg="Your custom filters have been updated.")
|
return render_template(f"{template}settings_filters.html", v=v, msg="Your custom filters have been updated.")
|
||||||
|
|
||||||
|
@ -474,7 +474,7 @@ def changelogsub(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def namecolor(v):
|
def namecolor(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
color = str(request.values.get("color", "")).strip()
|
color = str(request.values.get("color", "")).strip()
|
||||||
|
@ -490,7 +490,7 @@ def namecolor(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def themecolor(v):
|
def themecolor(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
themecolor = str(request.values.get("themecolor", "")).strip()
|
themecolor = str(request.values.get("themecolor", "")).strip()
|
||||||
|
@ -570,7 +570,7 @@ def gumroad(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def titlecolor(v):
|
def titlecolor(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
titlecolor = str(request.values.get("titlecolor", "")).strip()
|
titlecolor = str(request.values.get("titlecolor", "")).strip()
|
||||||
|
@ -586,7 +586,7 @@ def titlecolor(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def verifiedcolor(v):
|
def verifiedcolor(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
verifiedcolor = str(request.values.get("verifiedcolor", "")).strip()
|
verifiedcolor = str(request.values.get("verifiedcolor", "")).strip()
|
||||||
|
@ -718,7 +718,7 @@ def settings_log_out_others(v):
|
||||||
submitted_password = request.values.get("password", "").strip()
|
submitted_password = request.values.get("password", "").strip()
|
||||||
|
|
||||||
if not v.verifyPass(submitted_password):
|
if not v.verifyPass(submitted_password):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_security.html", v=v, error="Incorrect Password"), 401
|
return render_template(f"{template}settings_security.html", v=v, error="Incorrect Password"), 401
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ def settings_log_out_others(v):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_security.html", v=v, msg="All other devices have been logged out")
|
return render_template(f"{template}settings_security.html", v=v, msg="All other devices have been logged out")
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ def settings_images_profile(v):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Profile picture successfully updated.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Profile picture successfully updated.")
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ def settings_images_banner(v):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully updated.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully updated.")
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ def settings_delete_profile(v):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v,
|
return render_template(f"{template}settings_profile.html", v=v,
|
||||||
msg="Profile picture successfully removed.")
|
msg="Profile picture successfully removed.")
|
||||||
|
@ -828,7 +828,7 @@ def settings_delete_banner(v):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully removed.")
|
return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully removed.")
|
||||||
|
|
||||||
|
@ -837,7 +837,7 @@ def settings_delete_banner(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_blockedpage(v):
|
def settings_blockedpage(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_blocks.html", v=v)
|
return render_template(f"{template}settings_blocks.html", v=v)
|
||||||
|
|
||||||
|
@ -845,7 +845,7 @@ def settings_blockedpage(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_css_get(v):
|
def settings_css_get(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_css.html", v=v)
|
return render_template(f"{template}settings_css.html", v=v)
|
||||||
|
|
||||||
|
@ -860,7 +860,7 @@ def settings_css(v):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_css.html", v=v)
|
return render_template(f"{template}settings_css.html", v=v)
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ def settings_css(v):
|
||||||
def settings_profilecss_get(v):
|
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."
|
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."
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profilecss.html", v=v)
|
return render_template(f"{template}settings_profilecss.html", v=v)
|
||||||
|
|
||||||
|
@ -884,7 +884,7 @@ def settings_profilecss(v):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profilecss.html", v=v)
|
return render_template(f"{template}settings_profilecss.html", v=v)
|
||||||
|
|
||||||
|
@ -954,7 +954,7 @@ def settings_unblock_user(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_apps(v):
|
def settings_apps(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_apps.html", v=v)
|
return render_template(f"{template}settings_apps.html", v=v)
|
||||||
|
|
||||||
|
@ -978,7 +978,7 @@ def settings_remove_discord(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_content_get(v):
|
def settings_content_get(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_filters.html", v=v)
|
return render_template(f"{template}settings_filters.html", v=v)
|
||||||
|
|
||||||
|
@ -993,14 +993,14 @@ def settings_name_change(v):
|
||||||
new_name=request.values.get("name").strip()
|
new_name=request.values.get("name").strip()
|
||||||
|
|
||||||
if new_name==v.username:
|
if new_name==v.username:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
error="You didn't change anything")
|
error="You didn't change anything")
|
||||||
|
|
||||||
if not re.match(valid_username_regex, new_name):
|
if not re.match(valid_username_regex, new_name):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -1016,7 +1016,7 @@ def settings_name_change(v):
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if x and x.id != v.id:
|
if x and x.id != v.id:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -1054,7 +1054,7 @@ def settings_song_change(v):
|
||||||
id = song.split("v=")[1]
|
id = song.split("v=")[1]
|
||||||
elif song.startswith("https://youtu.be/"):
|
elif song.startswith("https://youtu.be/"):
|
||||||
id = song.split("https://youtu.be/")[1]
|
id = song.split("https://youtu.be/")[1]
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, error=f"Not a youtube link.")
|
return render_template(f"{template}settings_profile.html", v=v, error=f"Not a youtube link.")
|
||||||
|
|
||||||
|
@ -1071,19 +1071,19 @@ 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()
|
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']
|
duration = req['items'][0]['contentDetails']['duration']
|
||||||
if duration == 'P0D':
|
if duration == 'P0D':
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, error=f"Can't use a live youtube video!")
|
return render_template(f"{template}settings_profile.html", v=v, error=f"Can't use a live youtube video!")
|
||||||
|
|
||||||
if "H" in duration:
|
if "H" in duration:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.")
|
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:
|
if "M" in duration:
|
||||||
duration = int(duration.split("PT")[1].split("M")[0])
|
duration = int(duration.split("PT")[1].split("M")[0])
|
||||||
if duration > 10:
|
if duration > 10:
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.")
|
return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.")
|
||||||
|
|
||||||
|
@ -1105,7 +1105,7 @@ def settings_song_change(v):
|
||||||
try: ydl.download([f"https://youtube.com/watch?v={id}"])
|
try: ydl.download([f"https://youtube.com/watch?v={id}"])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
@ -1128,7 +1128,7 @@ def settings_song_change(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def settings_title_change(v):
|
def settings_title_change(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
if v.flairchanged: abort(403)
|
if v.flairchanged: abort(403)
|
||||||
|
|
|
@ -16,7 +16,7 @@ site_name = environ.get("SITE_NAME").strip()
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def emojis(v):
|
def emojis(v):
|
||||||
emojis = (x.replace('.webp','') for x in os.listdir("files/assets/images/emojis"))
|
emojis = (x.replace('.webp','') for x in os.listdir("files/assets/images/emojis"))
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}emojis.html", v=v, emojis=emojis)
|
return render_template(f"{template}emojis.html", v=v, emojis=emojis)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ def participation_stats(v):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admin/content_stats.html", v=v, title="Content Statistics", data=data)
|
return render_template(f"{template}admin/content_stats.html", v=v, title="Content Statistics", data=data)
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ def cached_chart(days):
|
||||||
def patrons(v):
|
def patrons(v):
|
||||||
users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc(), User.id).all()
|
users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc(), User.id).all()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}patrons.html", v=v, users=users)
|
return render_template(f"{template}patrons.html", v=v, users=users)
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ def patrons(v):
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def admins(v):
|
def admins(v):
|
||||||
admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all()
|
admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}admins.html", v=v, admins=admins)
|
return render_template(f"{template}admins.html", v=v, admins=admins)
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ def log(v):
|
||||||
|
|
||||||
admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level > 1).all()]
|
admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level > 1).all()]
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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)
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ def log_item(id, v):
|
||||||
if v and v.admin_level > 1: types = ACTIONTYPES
|
if v and v.admin_level > 1: types = ACTIONTYPES
|
||||||
else: types = ACTIONTYPES2
|
else: types = ACTIONTYPES2
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
return render_template(f"{template}log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types)
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ def favicon():
|
||||||
@app.get("/api")
|
@app.get("/api")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def api(v):
|
def api(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}api.html", v=v)
|
return render_template(f"{template}api.html", v=v)
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ def api(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def contact(v):
|
def contact(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}contact.html", v=v)
|
return render_template(f"{template}contact.html", v=v)
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ 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", "")
|
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)
|
send_admin(v.id, message)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}contact.html", v=v, msg="Your message has been sent.")
|
return render_template(f"{template}contact.html", v=v, msg="Your message has been sent.")
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ def settings(v):
|
||||||
def settings_profile(v):
|
def settings_profile(v):
|
||||||
|
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_profile.html",
|
return render_template(f"{template}settings_profile.html",
|
||||||
v=v)
|
v=v)
|
||||||
|
@ -344,7 +344,7 @@ def settings_profile(v):
|
||||||
@app.get("/badges")
|
@app.get("/badges")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def badges(v):
|
def badges(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}badges.html", v=v, badges=BADGES)
|
return render_template(f"{template}badges.html", v=v, badges=BADGES)
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ def blocks(v):
|
||||||
users.append(get_account(x.user_id))
|
users.append(get_account(x.user_id))
|
||||||
targets.append(get_account(x.target_id))
|
targets.append(get_account(x.target_id))
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}blocks.html", v=v, users=users, targets=targets)
|
return render_template(f"{template}blocks.html", v=v, users=users, targets=targets)
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ def blocks(v):
|
||||||
def banned(v):
|
def banned(v):
|
||||||
|
|
||||||
users = [x for x in g.db.query(User).filter(User.is_banned > 0, User.unban_utc == 0).all()]
|
users = [x for x in g.db.query(User).filter(User.is_banned > 0, User.unban_utc == 0).all()]
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}banned.html", v=v, users=users)
|
return render_template(f"{template}banned.html", v=v, users=users)
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ def banned(v):
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def formatting(v):
|
def formatting(v):
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}formatting.html", v=v)
|
return render_template(f"{template}formatting.html", v=v)
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ def serviceworker():
|
||||||
def settings_security(v):
|
def settings_security(v):
|
||||||
|
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}settings_security.html",
|
return render_template(f"{template}settings_security.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
|
|
@ -35,7 +35,7 @@ def upvoters(v, username):
|
||||||
|
|
||||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'@{username} biggest simps')
|
return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'@{username} biggest simps')
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ def downvoters(v, username):
|
||||||
|
|
||||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'@{username} biggest haters')
|
return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'@{username} biggest haters')
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ def upvoting(v, username):
|
||||||
|
|
||||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'Who @{username} simps for')
|
return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'Who @{username} simps for')
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ def downvoting(v, username):
|
||||||
|
|
||||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'Who @{username} hates')
|
return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'Who @{username} hates')
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ def steal(v):
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def rentoids(v):
|
def rentoids(v):
|
||||||
users = g.db.query(User).filter(User.rent_utc > 0).all()
|
users = g.db.query(User).filter(User.rent_utc > 0).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}rentoids.html", v=v, users=users)
|
return render_template(f"{template}rentoids.html", v=v, users=users)
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ def thiefs(v):
|
||||||
successful = g.db.query(User).filter(User.steal_utc > 0).all()
|
successful = g.db.query(User).filter(User.steal_utc > 0).all()
|
||||||
failed = g.db.query(User).filter(User.fail_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()
|
failed2 = g.db.query(User).filter(User.fail2_utc > 0).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2)
|
return render_template(f"{template}thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2)
|
||||||
|
|
||||||
|
@ -287,10 +287,10 @@ def leaderboard(v):
|
||||||
|
|
||||||
if 'pcmemes.net' == request.host:
|
if 'pcmemes.net' == request.host:
|
||||||
users6 = users.order_by(User.basedcount.desc()).limit(10).all()
|
users6 = users.order_by(User.basedcount.desc()).limit(10).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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 = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users7=users7, users9=users9)
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ def messagereply(v):
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}comments.html", v=v, comments=[new_comment])
|
return render_template(f"{template}comments.html", v=v, comments=[new_comment])
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ def followers(username, v):
|
||||||
# if 'rdrama.net' in request.host and u.id == 147: abort(404)
|
# 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()]
|
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()
|
users = g.db.query(User).filter(User.id.in_(ids)).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}followers.html", v=v, u=u, users=users)
|
return render_template(f"{template}followers.html", v=v, u=u, users=users)
|
||||||
|
|
||||||
|
@ -525,19 +525,19 @@ def following(username, v):
|
||||||
# if 'rdrama.net' in request.host and u.id == 147: abort(404)
|
# 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()]
|
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()
|
users = g.db.query(User).filter(User.id.in_(ids)).all()
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}following.html", v=v, u=u, users=users)
|
return render_template(f"{template}following.html", v=v, u=u, users=users)
|
||||||
|
|
||||||
@app.get("/views")
|
@app.get("/views")
|
||||||
@auth_required
|
@auth_required
|
||||||
def visitors(v):
|
def visitors(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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)
|
viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True)
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}viewers.html", v=v, viewers=viewers)
|
return render_template(f"{template}viewers.html", v=v, viewers=viewers)
|
||||||
|
|
||||||
|
@ -562,7 +562,7 @@ def u_username(username, v=None):
|
||||||
|
|
||||||
if u.reserved:
|
if u.reserved:
|
||||||
if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"}
|
if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_reserved.html", u=u, v=v)
|
return render_template(f"{template}userpage_reserved.html", u=u, v=v)
|
||||||
|
|
||||||
|
@ -589,26 +589,26 @@ def u_username(username, v=None):
|
||||||
if v and u.id == LLM_ID:
|
if v and u.id == LLM_ID:
|
||||||
if int(time.time()) - v.rent_utc > 600:
|
if int(time.time()) - v.rent_utc > 600:
|
||||||
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v)
|
return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v)
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v)
|
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 v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||||
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_blocking.html", u=u, v=v)
|
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 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."}
|
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_blocked.html", u=u, v=v)
|
return render_template(f"{template}userpage_blocked.html", u=u, v=v)
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ def u_username(username, v=None):
|
||||||
|
|
||||||
if u.unban_utc:
|
if u.unban_utc:
|
||||||
if request.headers.get("Authorization"): {"data": [x.json for x in listing]}
|
if request.headers.get("Authorization"): {"data": [x.json for x in listing]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage.html",
|
return render_template(f"{template}userpage.html",
|
||||||
unban=u.unban_string,
|
unban=u.unban_string,
|
||||||
|
@ -650,7 +650,7 @@ def u_username(username, v=None):
|
||||||
|
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage.html",
|
return render_template(f"{template}userpage.html",
|
||||||
u=u,
|
u=u,
|
||||||
|
@ -684,7 +684,7 @@ def u_username_comments(username, v=None):
|
||||||
|
|
||||||
if u.reserved:
|
if u.reserved:
|
||||||
if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"}
|
if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_reserved.html",
|
return render_template(f"{template}userpage_reserved.html",
|
||||||
u=u,
|
u=u,
|
||||||
|
@ -695,24 +695,24 @@ def u_username_comments(username, v=None):
|
||||||
if v and u.id == LLM_ID:
|
if v and u.id == LLM_ID:
|
||||||
if int(time.time()) - v.rent_utc > 600:
|
if int(time.time()) - v.rent_utc > 600:
|
||||||
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v)
|
return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v)
|
||||||
else:
|
else:
|
||||||
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
if request.headers.get("Authorization"): return {"error": "That userpage is private"}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v)
|
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 v and hasattr(u, 'is_blocking') and u.is_blocking:
|
||||||
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_blocking.html", u=u, v=v)
|
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 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."}
|
if request.headers.get("Authorization"): return {"error": "This person is blocking you."}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_blocked.html", u=u, v=v)
|
return render_template(f"{template}userpage_blocked.html", u=u, v=v)
|
||||||
|
|
||||||
|
@ -765,7 +765,7 @@ def u_username_comments(username, v=None):
|
||||||
is_following = (v and user.has_follower(v))
|
is_following = (v and user.has_follower(v))
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [c.json for c in listing]}
|
if request.headers.get("Authorization"): return {"data": [c.json for c in listing]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
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)
|
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)
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ def saved_posts(v, username):
|
||||||
listing = get_posts(ids, v=v)
|
listing = get_posts(ids, v=v)
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage.html",
|
return render_template(f"{template}userpage.html",
|
||||||
u=v,
|
u=v,
|
||||||
|
@ -923,7 +923,7 @@ def saved_comments(v, username):
|
||||||
|
|
||||||
|
|
||||||
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
if request.headers.get("Authorization"): return {"data": [x.json for x in listing]}
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}userpage_comments.html",
|
return render_template(f"{template}userpage_comments.html",
|
||||||
u=v,
|
u=v,
|
||||||
|
|
|
@ -15,7 +15,7 @@ defaultcolor = environ.get("DEFAULT_COLOR").strip()
|
||||||
@limiter.limit("5/second;60/minute;200/hour")
|
@limiter.limit("5/second;60/minute;200/hour")
|
||||||
@auth_desired
|
@auth_desired
|
||||||
def admin_vote_info_get(v):
|
def admin_vote_info_get(v):
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
|
|
||||||
if v and v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500
|
if v and v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500
|
||||||
|
@ -57,7 +57,7 @@ def admin_vote_info_get(v):
|
||||||
|
|
||||||
else: abort(400)
|
else: abort(400)
|
||||||
|
|
||||||
if v and v.oldsite: template = ''
|
if not v or v.oldsite: template = ''
|
||||||
else: template = 'CHRISTMAS/'
|
else: template = 'CHRISTMAS/'
|
||||||
return render_template(f"{template}votes.html",
|
return render_template(f"{template}votes.html",
|
||||||
v=v,
|
v=v,
|
||||||
|
|
Loading…
Reference in New Issue