diff --git a/files/classes/mix_ins.py b/files/classes/mix_ins.py index 731d36ab4..6c409d341 100644 --- a/files/classes/mix_ins.py +++ b/files/classes/mix_ins.py @@ -114,13 +114,11 @@ class Age_times: class Scores: @property - #@cache.memoize(timeout=60) def score_percent(self): return 101 @property - #@cache.memoize(timeout=60) def score(self): return int(self.score) or 0 @@ -128,7 +126,6 @@ class Scores: class Fuzzing: @property - #@cache.memoize(timeout=60) def score_fuzzed(self): real = self.score diff --git a/files/classes/user.py b/files/classes/user.py index 52a2c4a93..34bc29895 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -153,7 +153,7 @@ class User(Base, Stndrd, Age_times): def strid(self): return str(self.id) - @cache.memoize(300) + @cache.memoize() def userpagelisting(self, v=None, page=1, sort="new", t="all"): submissions = g.db.query(Submission).options(lazyload('*')).filter_by(author_id=self.id, is_pinned=False) @@ -195,7 +195,7 @@ class User(Base, Stndrd, Age_times): listing = [x.id for x in submissions[firstrange:secondrange]] return listing - @cache.memoize(300) + @cache.memoize() def commentlisting(self, v=None, page=1, sort="new", t="all"): comments = self.comments.options(lazyload('*')).filter(Comment.parent_submission != None).join(Comment.post) @@ -445,7 +445,7 @@ class User(Base, Stndrd, Age_times): if self.bannerurl: return self.bannerurl else: return f"https://{site}/assets/images/default_bg.png" - @cache.memoize(0) + @cache.memoize() def defaultpicture(self): pic = random.randint(1, 50) return f"https://{site}/assets/images/defaultpictures/{pic}.png" diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 44eb22d9f..ee7695127 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -32,7 +32,6 @@ def send_notification(vid, user, text): notif = Notification(comment_id=new_comment.id, user_id=user.id) g.db.add(notif) - g.db.commit() def send_pm(vid, user, text): @@ -55,7 +54,6 @@ def send_pm(vid, user, text): notif = Notification(comment_id=new_comment.id, user_id=user.id) g.db.add(notif) - g.db.commit() def send_follow_notif(vid, user, text): @@ -82,7 +80,6 @@ def send_follow_notif(vid, user, text): user_id=user, followsender=vid) g.db.add(notif) - g.db.commit() def send_unfollow_notif(vid, user, text): @@ -109,7 +106,6 @@ def send_unfollow_notif(vid, user, text): user_id=user, unfollowsender=vid) g.db.add(notif) - g.db.commit() def send_block_notif(vid, user, text): @@ -136,7 +132,6 @@ def send_block_notif(vid, user, text): user_id=user, blocksender=vid) g.db.add(notif) - g.db.commit() def send_unblock_notif(vid, user, text): @@ -163,7 +158,6 @@ def send_unblock_notif(vid, user, text): user_id=user, unblocksender=vid) g.db.add(notif) - g.db.commit() def send_admin(vid, text): @@ -187,4 +181,3 @@ def send_admin(vid, text): for admin in admins: notif = Notification(comment_id=new_comment.id, user_id=admin.id) g.db.add(notif) - g.db.commit() diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index 20897b42b..0227c509b 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -1,21 +1,4 @@ -from os import environ, path -from .get import * -from files.__main__ import app, cache - - -@app.template_filter("total_users") -@cache.memoize(timeout=60) -def total_users(x): - - return db.query(User).filter_by(is_banned=0).count() - - -@app.template_filter("source_code") -@cache.memoize(timeout=60 * 60 * 24) -def source_code(file_name): - - return open(path.expanduser('~') + '/files/' + - file_name, mode="r+").read() +from files.__main__ import app @app.template_filter("full_link") @@ -24,28 +7,6 @@ def full_link(url): return f"https://{app.config['SERVER_NAME']}{url}" -@app.template_filter("env") -def env_var_filter(x): - - x = environ.get(x, 1) - - try: - return int(x) - except BaseException: - try: - return float(x) - except BaseException: - return x - - -@app.template_filter("js_str_escape") -def js_str_escape(s): - - s = s.replace("'", r"\'") - - return s - - @app.template_filter("app_config") def app_config(x): return app.config.get(x) \ No newline at end of file diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 0fb05f179..d884b6337 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -66,7 +66,7 @@ def check_ban_evade(v): ) g.db.add(ma) - g.db.commit() + g.db.flush() for comment in g.db.query(Comment).filter_by(author_id=v.id).all(): if comment.is_banned: @@ -84,14 +84,14 @@ def check_ban_evade(v): ) g.db.add(ma) - g.db.commit() + g.db.flush() try: abort(403) except Exception as e: print(e) else: v.ban_evade +=1 g.db.add(v) - g.db.commit() + g.db.flush() diff --git a/files/routes/admin.py b/files/routes/admin.py index b804e7279..610109079 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -158,7 +158,6 @@ def badge_grant_post(v): if user.has_badge(badge_id): g.db.query(Badge).filter_by(badge_id=badge_id, user_id=user.id,).delete() - g.db.commit() return redirect(user.url) new_badge = Badge(badge_id=badge_id, @@ -173,8 +172,6 @@ def badge_grant_post(v): g.db.add(new_badge) - g.db.commit() - text = f""" @{v.username} has given you the following profile badge: \n\n![]({new_badge.path}) @@ -370,7 +367,6 @@ def admin_link_accounts(v): ) g.db.add(new_alt) - g.db.commit() return redirect(f"/admin/alt_votes?u1={g.db.query(User).get(u1).username}&u2={g.db.query(User).get(u2).username}") @@ -463,7 +459,6 @@ def admin_image_ban(v): ) g.db.add(new_bp) - g.db.commit() return render_template("admin/image_ban.html", v=v, success=True) @@ -505,10 +500,9 @@ def agendaposter(user_id, v): ) g.db.add(ma) - if 'toast' in request.args: - return "", 204 - else: - return redirect(user.url) + user.refresh_selfset_badges() + + return "", 204 @app.post("/shadowban/") @admin_level_required(6) @@ -601,8 +595,8 @@ def ban_user(user_id, v): # check for number of days for suspension days = int(request.form.get("days")) if request.form.get('days') else 0 - reason = request.form.get("reason", "") - message = request.form.get("reason", "") + reason = request.values.get("reason", "") + message = request.values.get("reason", "") if not user: abort(400) @@ -640,11 +634,9 @@ def ban_user(user_id, v): note=f'reason: "{reason}", duration: {duration}' ) g.db.add(ma) - g.db.commit() - if request.args.get("notoast"): return (redirect(user.url), user) - - return {"message": f"@{user.username} was banned"} + if 'reason' in request.args: return {"message": f"@{user.username} was banned!"} + else: return redirect(user.url) @app.post("/unban_user/") @@ -673,10 +665,11 @@ def unban_user(user_id, v): target_user_id=user.id, ) g.db.add(ma) - g.db.commit() - if request.args.get("notoast"): return (redirect(user.url), user) - return {"message": f"@{user.username} was unbanned"} + if 'reason' in request.args: + return {"message": f"@{user.username} was unbanned!"} + else: + return redirect(user.url) @app.post("/ban_post/") @admin_level_required(3) @@ -776,7 +769,6 @@ def api_sticky_post(post_id, v): if post: post.stickied = not (post.stickied) g.db.add(post) - g.db.commit() cache.delete_memoized(frontlist) @@ -852,7 +844,6 @@ def admin_distinguish_comment(c_id, v): comment.distinguish_level = 0 if comment.distinguish_level else v.admin_level g.db.add(comment) - g.db.commit() html=render_template( "comments.html", v=v, @@ -864,18 +855,6 @@ def admin_distinguish_comment(c_id, v): return html -@app.get("/admin/refund") -@admin_level_required(6) -def refund(v): - for u in g.db.query(User).all(): - if u.id == 253: continue - posts=sum([x[0]+x[1]-1 for x in g.db.query(Submission.upvotes, Submission.downvotes).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()]) - comments=sum([x[0]+x[1]-1 for x in g.db.query(Comment.upvotes, Comment.downvotes).options(lazyload('*')).filter_by(author_id = u.id, is_banned = False, deleted_utc = 0).all()]) - u.coins = int(posts+comments) - g.db.add(u) - return "sex" - - @app.get("/admin/dump_cache") @admin_level_required(6) def admin_dump_cache(v): @@ -970,7 +949,6 @@ def admin_nunuke_user(v): @app.get("/admin/user_stat_data") @admin_level_required(2) -@cache.memoize(timeout=60) def user_stat_data(v): days = int(request.args.get("days", 25)) diff --git a/files/routes/comments.py b/files/routes/comments.py index 10ff8a15e..ea678a947 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -150,7 +150,7 @@ def api_comment(v): body = request.form.get("body", "")[:10000] body = body.strip() - if not body and not request.files.get('file'): return jsonify({"error":"You need to actually write something!"}), 400 + if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400 for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|PNG|JPG|JPEG|GIF))', body, re.MULTILINE): body = body.replace(i.group(1), f'![]({i.group(1)})') body = body.replace("\n", "\n\n").replace("\n\n\n\n\n\n", "\n\n").replace("\n\n\n\n", "\n\n").replace("\n\n\n", "\n\n") @@ -171,7 +171,7 @@ def api_comment(v): v.ban(days=30, reason="Digitally malicious content") if any([x.reason==7 for x in bans]): v.ban( reason="Sexualizing minors") - return jsonify({"error": reason}), 401 + return {"error": reason}, 401 # check existing existing = g.db.query(Comment).join(CommentAux).filter(Comment.author_id == v.id, @@ -181,11 +181,10 @@ def api_comment(v): CommentAux.body == body ).options(contains_eager(Comment.comment_aux)).first() if existing: - return jsonify({"error": f"You already made that comment: {existing.permalink}"}), 409 + return {"error": f"You already made that comment: {existing.permalink}"}, 409 if parent.author.any_block_exists(v) and not v.admin_level>=3: - return jsonify( - {"error": "You can't reply to users who have blocked you, or users you have blocked."}), 403 + return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403 # get bot status is_bot = request.headers.get("X-User-Type","")=="Bot" @@ -235,8 +234,7 @@ def api_comment(v): ) g.db.add(ma) - g.db.commit() - return jsonify({"error": "Too much spam!"}), 403 + return {"error": "Too much spam!"}, 403 # check badlinks soup = BeautifulSoup(body_html, features="html.parser") @@ -256,8 +254,7 @@ def api_comment(v): literal(check_url).contains( BadLink.link)).first() - if badlink: - return jsonify({"error": f"Remove the following link and try again: `{check_url}`. Reason: {badlink.reason}"}), 403 + if badlink: return {"error": f"Remove the following link and try again: `{check_url}`. Reason: {badlink.reason}"}, 403 # create comment parent_id = parent_fullname.split("_")[1] c = Comment(author_id=v.id, @@ -273,10 +270,8 @@ def api_comment(v): g.db.flush() if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": file=request.files["file"] - if not file.content_type.startswith('image/'): - return jsonify({"error": "That wasn't an image!"}), 400 + if not file.content_type.startswith('image/'): return {"error": "That wasn't an image!"}, 400 - name = f'comment/{c.id}/{secrets.token_urlsafe(8)}' url = upload_file(file) body = request.form.get("body") + f"\n![]({url})" @@ -507,7 +502,7 @@ def api_comment(v): c=get_comment(c.id, v=v) cache.delete_memoized(comment_idlist) - cache.delete_memoized(User.commentlisting, v) + cache.delete_memoized(User.commentlisting, v=v) v.comment_count = v.comments.filter(Comment.parent_submission != None).filter_by(is_banned=False, deleted_utc=0).count() g.db.add(v) @@ -618,7 +613,6 @@ def edit_comment(cid, v): comment.ban_reason = "Automatic spam removal. This happened because the post's creator submitted too much similar content too quickly." g.db.add(comment) - g.db.commit() return {"error": "Too much spam!"}, 403 if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1": @@ -680,9 +674,7 @@ def edit_comment(cid, v): g.db.add(c) - g.db.commit() - - path = request.form.get("current_page", "/") + g.db.flush() # queue up notifications for username mentions notify_users = set() @@ -727,9 +719,9 @@ def delete_comment(cid, v): c.deleted_utc = int(time.time()) g.db.add(c) - g.db.commit() - cache.delete_memoized(User.commentlisting, v) + cache.delete_memoized(comment_idlist) + cache.delete_memoized(User.commentlisting, v=v) return "", 204 @@ -750,7 +742,8 @@ def undelete_comment(cid, v): g.db.add(c) - cache.delete_memoized(User.commentlisting, v) + cache.delete_memoized(comment_idlist) + cache.delete_memoized(User.commentlisting, v=v) return "", 204 @@ -768,7 +761,7 @@ def toggle_comment_pin(cid, v): comment.is_pinned = not comment.is_pinned g.db.add(comment) - g.db.commit() + g.db.flush() if v.admin_level == 6: ma=ModAction( diff --git a/files/routes/discord.py b/files/routes/discord.py index 6e29b5fc7..4fc7baa86 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -101,7 +101,6 @@ def discord_redirect(v): v.discord_id=x["id"] g.db.add(v) - g.db.commit() url=f"https://discord.com/api/guilds/{SERVER_ID}/members/{x['id']}" diff --git a/files/routes/feeds.py b/files/routes/feeds.py index bcee4c7bf..ef8fd87af 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -12,7 +12,7 @@ def feeds_user(sort='hot', t='all'): page = int(request.args.get("page", 1)) - posts = frontlist( + posts, next_exists = frontlist( sort=sort, page=page, t=t, diff --git a/files/routes/front.py b/files/routes/front.py index 9fa1b6935..70e91a82c 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -72,7 +72,7 @@ def notifications(v): render_replies=True, is_notification_page=True) -@cache.memoize(timeout=1500) +@cache.memoize() def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words='', **kwargs): posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False,stickied=False,private=False).filter(Submission.deleted_utc == 0) @@ -174,10 +174,13 @@ def frontlist(v=None, sort="hot", page=1,t="all", ids_only=True, filter_words='' posts = [x for x in posts if not (x.author and x.author.shadowbanned) or (v and v.id == x.author_id)][:26] - if ids_only: - posts = [x.id for x in posts] - return posts - return posts + next_exists = (len(posts) == 26) + + posts = posts[:25] + + if ids_only: posts = [x.id for x in posts] + + return posts, next_exists @app.get("/") @auth_desired @@ -201,7 +204,7 @@ def front_all(v): sort=request.args.get("sort", defaultsorting) t=request.args.get('t', defaulttime) - ids = frontlist(sort=sort, + ids, next_exists = frontlist(sort=sort, page=page, t=t, v=v, @@ -210,17 +213,12 @@ def front_all(v): filter_words=v.filter_words if v else [], ) - # check existence of next page - next_exists = (len(ids) == 26) - ids = ids[:25] - - # check if ids exist 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("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) -@cache.memoize(timeout=1500) +@cache.memoize() def changeloglist(v=None, sort="new", page=1 ,t="all", **kwargs): posts = g.db.query(Submission).options(lazyload('*')).filter_by(is_banned=False,stickied=False,private=False,).filter(Submission.deleted_utc == 0) @@ -334,7 +332,7 @@ def random_post(v): post = x.order_by(Submission.id.asc()).offset(n).limit(1).first() return redirect(post.permalink) -@cache.memoize(600) +@cache.memoize() def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all", **kwargs): posts = g.db.query(Submission).options(lazyload('*')) diff --git a/files/routes/login.py b/files/routes/login.py index c13acb9a5..754469573 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -346,7 +346,7 @@ def sign_up_post(v): return new_signup("Please enter a valid email") g.db.add(new_user) - g.db.commit() + g.db.flush() # give a beta badge beta_badge = Badge(user_id=new_user.id, @@ -570,7 +570,6 @@ def reset_2fa(): user.mfa_secret=None g.db.add(user) - g.db.commit() return render_template("message_success.html", title="Two-factor authentication removed.", diff --git a/files/routes/oauth.py b/files/routes/oauth.py index 5cdf7341d..c122f7474 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -63,8 +63,6 @@ def delete_oauth_app(v, aid): for auth in g.db.query(ClientAuth).filter_by(oauth_client=app.id).all(): g.db.delete(auth) - g.db.commit() - g.db.delete(app) return redirect('/apps') diff --git a/files/routes/posts.py b/files/routes/posts.py index 0a4937b67..3a64c3a76 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -16,7 +16,7 @@ from flask import * from io import BytesIO from files.__main__ import app, limiter, cache from PIL import Image as PILimage -from .front import frontlist +from .front import frontlist, changeloglist site = environ.get("DOMAIN").strip() @@ -201,7 +201,6 @@ def post_id(pid, anything=None, v=None): post.views += 1 g.db.add(post) - g.db.commit() if isinstance(session.get('over_18', 0), dict): session["over_18"] = 0 if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()): if request.headers.get("Authorization"): return {"error":"Must be 18+ to view"}, 451 @@ -483,7 +482,6 @@ def thumbs(new_post): post.thumburl = upload_file(resize=True) g.db.add(post) - g.db.commit() def archiveorg(url): try: requests.get(f'https://web.archive.org/save/{url}', headers={'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}, timeout=100) @@ -702,7 +700,6 @@ def submit_post(v): note="spam" ) g.db.add(ma) - g.db.commit() return redirect("/notifications") # catch too-long body @@ -830,17 +827,12 @@ def submit_post(v): new_post.url = upload_file(file) g.db.add(new_post) g.db.add(new_post.submission_aux) - g.db.commit() - g.db.commit() + g.db.flush() # spin off thumbnail generation and csam detection as new threads if (new_post.url or request.files.get('file')) and (v.is_activated or request.headers.get('cf-ipcountry')!="T1"): thumbs(new_post) - - cache.delete_memoized(User.userpagelisting) - g.db.commit() - notify_users = set() soup = BeautifulSoup(body_html, features="html.parser") @@ -857,7 +849,7 @@ def submit_post(v): send_notification(2360, user, f"@{v.username} has made a new post: [{title}](https://{site}{new_post.permalink})") g.db.add(new_post) - g.db.commit() + g.db.flush() if v.agendaposter and "trans lives matter" not in new_post_aux.body_html.lower(): @@ -928,13 +920,15 @@ def submit_post(v): g.db.flush() n = Notification(comment_id=c.id, user_id=v.id) g.db.add(n) - g.db.commit() + g.db.flush() send_message(f"https://{site}{new_post.permalink}") v.post_count = v.submissions.filter_by(is_banned=False, deleted_utc=0).count() g.db.add(v) + cache.delete_memoized(User.userpagelisting, v=v) cache.delete_memoized(frontlist) + if "[changelog]" in new_post.title: cache.delete_memoized(changeloglist) if request.headers.get("Authorization"): return new_post.json else: return redirect(new_post.permalink) diff --git a/files/routes/search.py b/files/routes/search.py index efacf8d4c..1816c5aba 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -30,7 +30,6 @@ def searchparse(text): return criteria -@cache.memoize(300) def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None): posts = g.db.query(Submission).options( @@ -144,7 +143,6 @@ def searchlisting(criteria, v=None, page=1, t="None", sort="top", b=None): return total, [x.id for x in posts] -@cache.memoize(300) def searchcommentlisting(criteria, v=None, page=1, t="None", sort="top"): comments = g.db.query(Comment).options(lazyload('*')).filter(Comment.parent_submission != None).join(Comment.comment_aux) diff --git a/files/routes/settings.py b/files/routes/settings.py index b35661673..62549a2f2 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -160,7 +160,7 @@ def changelogsub(v): v.changelogsub = not v.changelogsub g.db.add(v) - cache.delete_memoized(frontlist) + cache.delete_memoized(frontlist, v=v) return "", 204 @@ -467,11 +467,9 @@ def settings_block_user(v): existing = g.db.query(Notification).filter_by(blocksender=v.id, user_id=user.id).first() if not existing: send_block_notif(v.id, user.id, f"@{v.username} has blocked you!") - if request.args.get("notoast"): return "", 204 - if v.admin_level == 1: return {"message": f"@{user.username} banned!"} - cache.delete_memoized(frontlist) + cache.delete_memoized(frontlist, v=v) return {"message": f"@{user.username} blocked."} @@ -494,11 +492,9 @@ def settings_unblock_user(v): existing = g.db.query(Notification).filter_by(unblocksender=v.id, user_id=user.id).first() if not existing: send_unblock_notif(v.id, user.id, f"@{v.username} has unblocked you!") - if request.args.get("notoast"): return "", 204 - if v.admin_level == 1: return {"message": f"@{user.username} unbanned!"} - cache.delete_memoized(frontlist) + cache.delete_memoized(frontlist, v=v) return {"message": f"@{user.username} unblocked."} @@ -523,7 +519,6 @@ def settings_remove_discord(v): v.discord_id=None g.db.add(v) - g.db.commit() return redirect("/settings/profile") @@ -578,7 +573,6 @@ def settings_name_change(v): set_nick(v, new_name) g.db.add(v) - g.db.commit() return redirect("/settings/profile") @@ -610,7 +604,6 @@ def settings_song_change(v): if path.isfile(f'/songs/{id}.mp3'): v.song=id g.db.add(v) - g.db.commit() return redirect("/settings/profile") @@ -691,8 +684,6 @@ def settings_title_change(v): v.customtitle = new_name g.db.add(v) - g.db.commit() - return redirect("/settings/profile") @app.post("/settings/badges") diff --git a/files/routes/users.py b/files/routes/users.py index 938d60e10..6d05d8eeb 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -62,8 +62,6 @@ def transfer_coins(v, username): g.db.add(receiver) g.db.add(v) - g.db.commit() - transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!" send_notification(v.id, receiver, transfer_message) return {"message": f"{amount} {app.config['COINS_NAME']} transferred!"}, 200 @@ -132,7 +130,6 @@ def messagereply(v, username, id): g.db.add(new_aux) notif = Notification(comment_id=new_comment.id, user_id=user.id) g.db.add(notif) - g.db.commit() return redirect('/notifications?all=true') @app.get("/songs/") @@ -147,7 +144,6 @@ def songs(id): def subscribe(v, post_id): new_sub = Subscription(user_id=v.id, submission_id=post_id) g.db.add(new_sub) - g.db.commit() return "", 204 @app.post("/unsubscribe/") diff --git a/files/templates/changelog.html b/files/templates/changelog.html index 11c08ea8d..03419e009 100644 --- a/files/templates/changelog.html +++ b/files/templates/changelog.html @@ -66,7 +66,7 @@ {% block content %} {% if v %} - + {% endif %}
diff --git a/files/templates/comments.html b/files/templates/comments.html index e830d92f9..1e657eab5 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -244,9 +244,9 @@
  • Votes
  • {% if v and c.id in v.saved_comment_idlist() %} -
  • Unsave
  • +
  • Unsave
  • {% else %} -
  • Save
  • +
  • Save
  • {% endif %} {% if v %} @@ -274,7 +274,7 @@
  • Edit
  • {% if c.deleted_utc > 0 %} -
  • Undelete
  • +
  • Undelete
  • {% else %}
  • Delete
  • {% endif %} @@ -291,7 +291,7 @@ {% endif %} {% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %} -
  • {{'Unpin' if c.is_pinned else 'Pin'}}
  • +
  • {{'Unpin' if c.is_pinned else 'Pin'}}
  • {% endif %} @@ -302,14 +302,14 @@ {% endif %} {% if v and c.parent_submission and (c.author_id==v.id or v.admin_level > 0) %} -
  • Toggle +18
  • +
  • Toggle +18
  • {% endif %} {% if v and v.admin_level==6 and v.id != c.author_id %} {% if c.author.is_banned %}
  • Unban user
  • {% else %} -
  • Ban user
  • +
  • Ban user
  • {% endif %} {% endif %} @@ -411,9 +411,9 @@
  • Votes
  • {% if v and c.id in v.saved_comment_idlist() %} -
  • Unsave
  • +
  • Unsave
  • {% else %} -
  • Save
  • +
  • Save
  • {% endif %}
  • Copy link
  • @@ -427,7 +427,7 @@ {% if c.deleted_utc > 0 %} -
  • Undelete
  • +
  • Undelete
  • {% else %}
  • Delete
  • {% endif %} @@ -436,7 +436,7 @@ {% endif %} {% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %} -
  • {{'Unpin' if c.is_pinned else 'Pin'}} +
  • {{'Unpin' if c.is_pinned else 'Pin'}}
  • {% endif %} @@ -460,7 +460,7 @@ {% endif %} {% if v and c.parent_submission and (c.author_id==v.id or v.admin_level > 0) %} -
  • Toggle +18
  • +
  • Toggle +18
  • {% endif %} {% if v and (c.post and v.admin_level == 6) %} @@ -468,7 +468,7 @@ {% if c.author.is_banned %}
  • Unban user
  • {% else %} -
  • Ban user
  • +
  • Ban user
  • {% endif %} {% endif %} {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index eb4a80264..3a6913326 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -107,7 +107,7 @@

    diff --git a/files/templates/settings_blocks.html b/files/templates/settings_blocks.html index bdea67d48..9d1fd227b 100644 --- a/files/templates/settings_blocks.html +++ b/files/templates/settings_blocks.html @@ -68,7 +68,7 @@ diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 97a171aad..e231b8134 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -24,7 +24,7 @@

    Change the theme for the website.

    - {% for entry in ["dark", "light", "coffee", "tron", "4chan", "midnight"] %}