diff --git a/files/routes/front.py b/files/routes/front.py index 63ce2b56e..e424945ad 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -160,7 +160,7 @@ def front_all(v, sub=None): sort=request.values.get("sort", defaultsorting) t=request.values.get('t', defaulttime) ccmode=request.values.get('ccmode', "false") - subs=request.values.get('subs', "false") + subs=session.get('subs', False) try: gt=int(request.values.get("utc_greater_than", 0)) except: gt=0 @@ -259,17 +259,17 @@ def front_all(v, sub=None): g.db.commit() if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} - return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, subs=subs, sub=sub, home=True) + return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, sub=sub, subs=subs, home=True) @cache.memoize(timeout=86400) -def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false", subs="false", filter_words='', gt=0, lt=0, sub=None, site=None): +def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false", subs=False, filter_words='', gt=0, lt=0, sub=None, site=None): posts = g.db.query(Submission) if sub: posts = posts.filter_by(sub=sub.name) - elif subs == "true": + elif subs: if v and v.all_blocks: posts = posts.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks))) else: if SITE_NAME == 'Drama': posts = posts.filter(Submission.sub == None) @@ -351,7 +351,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false" and not gt and not lt: pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False) if sub: pins = pins.filter_by(sub=sub.name) - elif subs == "true": + elif subs: if v and v.all_blocks: pins = pins.filter(or_(Submission.sub == None, Submission.sub.notin_(v.all_blocks))) else: if SITE_NAME == 'Drama': pins = pins.filter(Submission.sub == None) diff --git a/files/routes/subs.py b/files/routes/subs.py index ebad48984..28702777c 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -425,4 +425,17 @@ def sub_sidebar(v, sub): g.db.add(sub) g.db.commit() - return redirect(f'/s/{sub.name}/settings') \ No newline at end of file + return redirect(f'/s/{sub.name}/settings') + + +@app.post("/sub_toggle") +def sub_toggle(): + session["subs"] = not session.get("subs") + return '', 204 + + +@app.get("/subs") +@auth_desired +def subs(v): + subs = g.db.query(Submission.sub, func.count(Submission.sub)).group_by(Submission.sub).order_by(func.count(Submission.sub).desc()).all()[:-1] + return render_template('sub/subs.html', v=v, subs=subs) \ No newline at end of file diff --git a/files/templates/admin/awards.html b/files/templates/admin/awards.html index 5c4b4f6da..adac611be 100644 --- a/files/templates/admin/awards.html +++ b/files/templates/admin/awards.html @@ -52,7 +52,7 @@ {% for a in awards %} - {{a['title']}} + {{a['title']}} {% endfor %} diff --git a/files/templates/admin/banned_domains.html b/files/templates/admin/banned_domains.html index 64c354b3f..d55f6ed8c 100644 --- a/files/templates/admin/banned_domains.html +++ b/files/templates/admin/banned_domains.html @@ -13,14 +13,14 @@
- - + + {% for domain in banned_domains %} - + {% endfor %} diff --git a/files/templates/admins.html b/files/templates/admins.html index 85a1d2d44..c6120dda9 100644 --- a/files/templates/admins.html +++ b/files/templates/admins.html @@ -13,18 +13,18 @@
DomainBan reasonDomainBan reason
{{domain.domain}}{{domain.domain}} {{domain.reason}}
- - - - + + + + {% for user in admins %} - - - - + + + + {% endfor %}
#NameTruescoreMod actions#NameTruescoreMod actions
{{loop.index}}{{user.username}}{% if user.admin_level == 1 and v and v.admin_level > 1 %}{% endif %}{{user.truecoins}}{{user.modaction_num}}{{loop.index}}{{user.username}}{% if user.admin_level == 1 and v and v.admin_level > 1 %}{% endif %}{{user.truecoins}}{{user.modaction_num}}
diff --git a/files/templates/agendaposters.html b/files/templates/agendaposters.html index 521fadc70..a73acfd93 100644 --- a/files/templates/agendaposters.html +++ b/files/templates/agendaposters.html @@ -4,14 +4,14 @@
- - + + {% for user in users %} - - + + {% endfor %}
#Name#Name
{{loop.index}}{{user.username}}{{loop.index}}{{user.username}}
diff --git a/files/templates/authforms.html b/files/templates/authforms.html index b377ec583..5de5aa650 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,7 +15,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/badges.html b/files/templates/badges.html index 05f466112..d4de554df 100644 --- a/files/templates/badges.html +++ b/files/templates/badges.html @@ -21,7 +21,7 @@ {% for badge in badges %} - {{loop.index}} + {{loop.index}} {{badge.name}} {{badge.name}} {{badge.description}} diff --git a/files/templates/banned.html b/files/templates/banned.html index f5c8cd942..ed53758ae 100644 --- a/files/templates/banned.html +++ b/files/templates/banned.html @@ -4,18 +4,18 @@
- - - - + + + + {% for user in users %} - - - - + + + + {% endfor %}
#NameBan reasonBanned by#NameBan reasonBanned by
{{loop.index}}{{user.username}}{% if user.ban_reason %}{{user.ban_reason}}{% endif %}{{user.banned_by.username}}{{loop.index}}{{user.username}}{% if user.ban_reason %}{{user.ban_reason}}{% endif %}{{user.banned_by.username}}
diff --git a/files/templates/blocks.html b/files/templates/blocks.html index 0b9d6a6c4..debb7ccdc 100644 --- a/files/templates/blocks.html +++ b/files/templates/blocks.html @@ -8,16 +8,16 @@
- - - + + + {% for user in users %} - - - + + + {% endfor %}
#UserTarget#UserTarget
{{loop.index}}{{user.username}}{{targets[loop.index-1].username}}{{loop.index}}{{user.username}}{{targets[loop.index-1].username}}
diff --git a/files/templates/comments.html b/files/templates/comments.html index 85b9cff5e..f2b759a1d 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -63,7 +63,7 @@ {% if (c.is_banned or c.deleted_utc or c.is_blocking) and not (v and v.admin_level > 1) and not (v and v.id==c.author_id) %}
- +
@@ -199,7 +199,7 @@ {% if c.bannedfor %} {% endif %} - {% if c.active_flags %}{{c.active_flags}} Reports{% endif %} + {% if c.active_flags %}{{c.active_flags}} Reports{% endif %} {% if c.over_18 %}+18{% endif %} {% if v and v.admin_level > 1 and c.author.shadowbanned %}{% endif %} {% if c.is_pinned %} @@ -254,8 +254,8 @@ {% set currency_kind = "Coins" if kind == "coins" else "Marseybucks" %} {{player_hand}} vs. {{dealer_hand}} {% if blackjack_status == 'active' and v.id == c.author_id %} - - + + {% elif blackjack_status == 'push' %} Pushed. Refunded {{wager}} {{currency_kind}}. {% elif blackjack_status == 'bust' %} @@ -273,8 +273,8 @@ {{wordle_guesses}} {% if wordle_status == 'active' and v.id == c.author_id %} - + display: initial"placeholder="5-letter guess"> + {% elif wordle_status == 'won' %} Correct! {% elif wordle_status == 'lost' %} @@ -596,7 +596,7 @@
- Comment + Comment Cancel
@@ -634,7 +634,7 @@
Cancel - Reply + Reply
@@ -871,7 +871,7 @@ {% if v %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 9952603c4..2c9312875 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -7,7 +7,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} {% if sub and sub.css and not request.path.endswith('settings') %} diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index 1de1023d4..3d54135b6 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -106,4 +106,4 @@
- \ No newline at end of file + \ No newline at end of file diff --git a/files/templates/followers.html b/files/templates/followers.html index ad2474130..eecf27f68 100644 --- a/files/templates/followers.html +++ b/files/templates/followers.html @@ -10,18 +10,18 @@
- - + + {% if v.id == u.id %} - + {% endif %} {% for user in users %} - - + + {% if v.id == u.id %} {% endif %} diff --git a/files/templates/following.html b/files/templates/following.html index c313d0efb..4a0282092 100644 --- a/files/templates/following.html +++ b/files/templates/following.html @@ -10,18 +10,18 @@
#Name#Name
{{loop.index}}{{user.username}}{{loop.index}}{{user.username}}
Remove follow
- - + + {% if v.id == u.id %} - + {% endif %} {% for user in users %} - - + + {% if v.id == u.id %} {% endif %} diff --git a/files/templates/gif_modal.html b/files/templates/gif_modal.html index f0683b42c..3b0e3f850 100644 --- a/files/templates/gif_modal.html +++ b/files/templates/gif_modal.html @@ -26,4 +26,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/files/templates/grassed.html b/files/templates/grassed.html index 97a28c0a7..c57fb176d 100644 --- a/files/templates/grassed.html +++ b/files/templates/grassed.html @@ -5,16 +5,16 @@
#Name#Name
{{loop.index}}{{user.username}}{{loop.index}}{{user.username}}
Unfollow
- - - + + + {% for user in users %} - - - + + + {% endfor %}
#NameGrasser#NameGrasser
{{loop.index}}{{user.username}}{{user.ban_reason.split('by ')[1]}}{{loop.index}}{{user.username}}{{user.ban_reason.split('by ')[1]}}
diff --git a/files/templates/header.html b/files/templates/header.html index 53156e35a..daa3ce9c3 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -196,7 +196,7 @@
- + {% if v and not err %}
{{v.formkey}}
diff --git a/files/templates/home.html b/files/templates/home.html index 9339f2f7f..1d82838fd 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -38,13 +38,17 @@ {% block navbar %}
{% if request.path == '/' and v.paid_dues %} - {% if ccmode=="true"%}CC{% endif %} - {% if ccmode=="false" %}CC{% endif %} + {% if ccmode=="true"%}CC{% endif %} + {% if ccmode=="false" %}CC{% endif %} {% endif %} {% if request.path == '/' and v and v.admin_level > 1 and SITE_NAME == 'Drama' %} - {% if subs=="true"%}Subs{% endif %} - {% if subs=="false" %}Subs{% endif %} + {% if subs %} + {% set classes='btn-primary text-primary' %} + {% else %} + {% set classes='btn-secondary' %} + {% endif %} + {% endif %} @@ -80,13 +84,13 @@ {{sort | capitalize}}
@@ -153,14 +157,14 @@