diff --git a/files/classes/user.py b/files/classes/user.py index 10f3d2157..242a645d3 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -82,6 +82,7 @@ class User(Base): mute = Column(Boolean) unmutable = Column(Boolean) eye = Column(Boolean) + alt = Column(Boolean) frontsize = Column(Integer, default=25) controversial = Column(Boolean, default=False) bio = deferred(Column(String)) diff --git a/files/helpers/const.py b/files/helpers/const.py index 80ff68edf..649335fea 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -322,6 +322,15 @@ AWARDS = { "color": "text-silver", "price": 10000 }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "price": 50000 + }, + } AWARDS2 = { @@ -437,6 +446,14 @@ AWARDS2 = { "color": "text-success", "price": 40000 }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "price": 50000 + }, } TROLLTITLES = [ diff --git a/files/routes/awards.py b/files/routes/awards.py index be54c782c..db4fa81c9 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -188,6 +188,16 @@ def shop(v): "price": 40000, "MB": False }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "owned": 0, + "price": 50000, + "MB": False + }, } for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): @@ -326,6 +336,14 @@ def buy(v, award): "color": "text-success", "price": 40000 }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "price": 50000 + }, } if award not in AWARDS: abort(400) @@ -499,13 +517,18 @@ def award_post(pid, v): send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) + elif kind == "marsey": + author.marseyawarded = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=83, user_id=author.id) g.db.add(new_badge) - elif kind == "marsey": - author.marseyawarded = time.time() + 86400 + elif kind == "alt": + author.alt = True + send_notification(995, f"@{v.username} bought {kind} award!") + new_badge = Badge(badge_id=84, user_id=author.id) + g.db.add(new_badge) post.author.received_award_count += 1 g.db.add(post.author) @@ -623,13 +646,18 @@ def award_comment(cid, v): send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) + elif kind == "marsey": + author.marseyawarded = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=83, user_id=author.id) g.db.add(new_badge) - elif kind == "marsey": - author.marseyawarded = time.time() + 86400 + elif kind == "alt": + author.alt = True + send_notification(995, f"@{v.username} bought {kind} award!") + new_badge = Badge(badge_id=84, user_id=author.id) + g.db.add(new_badge) c.author.received_award_count += 1 g.db.add(c.author) @@ -690,153 +718,4 @@ def admin_userawards_post(v): g.db.commit() if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) - - -@app.get("/api/shop/items") -@auth_required -def items(v): - AWARDS = { - "shit": { - "kind": "shit", - "title": "Shit", - "description": "Makes flies swarm the post.", - "icon": "fas fa-poop", - "color": "text-black-50", - "owned": 0, - "price": 500 - }, - "fireflies": { - "kind": "fireflies", - "title": "Fireflies", - "description": "Makes fireflies swarm the post.", - "icon": "fas fa-sparkles", - "color": "text-warning", - "owned": 0, - "price": 500 - }, - "train": { - "kind": "train", - "title": "Train", - "description": "Summons a train on the post.", - "icon": "fas fa-train", - "color": "text-pink", - "owned": 0, - "price": 500 - }, - "pin": { - "kind": "pin", - "title": "1-Hour Pin", - "description": "Pins the post/comment.", - "icon": "fas fa-thumbtack fa-rotate--45", - "color": "text-warning", - "owned": 0, - "price": 750 - }, - "unpin": { - "kind": "unpin", - "title": "1-Hour Unpin", - "description": "Removes 1 hour from the pin duration of the post/comment.", - "icon": "fas fa-thumbtack fa-rotate--45", - "color": "text-black", - "owned": 0, - "price": 1000 - }, - "flairlock": { - "kind": "flairlock", - "title": "1-Day Flairlock", - "description": "Sets a flair for the recipient and locks it or 24 hours.", - "icon": "fas fa-lock", - "color": "text-black", - "owned": 0, - "price": 1250 - }, - "agendaposter": { - "kind": "agendaposter", - "title": "Agendaposter", - "description": "Forces the agendaposter theme on the recipient for 24 hours.", - "icon": "fas fa-snooze", - "color": "text-purple", - "owned": 0, - "price": 2500 - }, - "marsey": { - "kind": "marsey", - "title": "Marsey", - "description": "Makes the recipient unable to post/comment anything but marsey emojis for 24 hours.", - "icon": "fas fa-cat", - "color": "text-orange", - "owned": 0, - "price": 3000 - }, - "ban": { - "kind": "ban", - "title": "1-Day Ban", - "description": "Bans the recipient for a day.", - "icon": "fas fa-gavel", - "color": "text-danger", - "owned": 0, - "price": 3000 - }, - "unban": { - "kind": "unban", - "title": "1-Day Unban", - "description": "Removes 1 day from the ban duration of the recipient.", - "icon": "fas fa-gavel", - "color": "text-success", - "owned": 0, - "price": 3500 - }, - "grass": { - "kind": "grass", - "title": "Grass", - "description": "Ban the recipient permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", - "icon": "fas fa-seedling", - "color": "text-success", - "owned": 0, - "price": 10000 - }, - "eye": { - "kind": "eye", - "title": "All-Seeing Eye", - "description": "Gives the recipient the ability to view private profiles.", - "icon": "fas fa-eye", - "color": "text-silver", - "owned": 0, - "price": 10000 - }, - "pause": { - "kind": "pause", - "title": "Pause", - "description": "Gives the recipient the ability to pause profile anthems.", - "icon": "fas fa-volume-mute", - "color": "text-danger", - "owned": 0, - "price": 20000 - }, - "unpausable": { - "kind": "unpausable", - "title": "Unpausable", - "description": "Makes the profile anthem of the recipient unpausable.", - "icon": "fas fa-volume", - "color": "text-success", - "owned": 0, - "price": 40000 - }, - } - - for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): AWARDS[useraward.kind]["owned"] += 1 - - if v.patron == 1: discount = 0.10 - elif v.patron == 2: discount = 0.15 - elif v.patron == 3: discount = 0.20 - elif v.patron == 4: discount = 0.25 - elif v.patron == 5: discount = 0.30 - else: discount = 0 - - for badge in [69,70,71,72,73]: - if v.has_badge(badge): discount += discounts[badge] - - for val in AWARDS.values(): val["discount"] = discount - - return AWARDS \ No newline at end of file + return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file diff --git a/files/routes/search.py b/files/routes/search.py index f12b5b745..9608b12e4 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -92,11 +92,11 @@ def searchposts(v): ) ) - if not(v and v.admin_level > 1): - posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False, Submission.deleted_utc == 0, Submission.is_banned == False) + if not (v and v.admin_level > 1): + posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False) + if not (v and v.eye): posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False) - if v and v.admin_level > 1: - pass + if v and v.admin_level > 1: pass elif v: blocking = [x[0] for x in g.db.query( UserBlock.target_id).filter_by( diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 536eb901e..230829ce7 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,11 +15,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 19bba7e52..cf46849fd 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -23,6 +23,11 @@
{{award.owned}} owned
{% endfor %} + + +
 
+
 
+
@@ -72,7 +77,7 @@ @media (min-width: 767.98px) { .award-columns { - column-count: 7 !important; + column-count: 8 !important; } } \ No newline at end of file diff --git a/files/templates/default.html b/files/templates/default.html index 977b29f0e..9b7fd738d 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -254,12 +254,12 @@ {% if v %} - - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} diff --git a/files/templates/log.html b/files/templates/log.html index 0f1985c6b..27578e4b8 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -17,11 +17,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 0f5567196..8bb2501e6 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -12,7 +12,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 726c52fec..82feeb1be 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -55,8 +55,8 @@ - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 3aad6cc77..c550f2b80 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -40,10 +40,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 41fb149a1..7ca7bd668 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -36,7 +36,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index d5da208bf..5cb8cb542 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 36c0d7f50..182fb1012 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -31,12 +31,12 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - - + + {% endif %} {% endblock %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 6ad228c95..855e60440 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -394,18 +394,20 @@ {% endif %}

 					

User ID: {{u.id}}

+

Coins spent: {{u.coins_spent}}

{% if v and v.admin_level > 1 %} +

True score: {{u.truecoins}}

{% if u.is_private %}

User has private mode enabled.

{% endif %} + {% endif %} + {% if v and (v.admin_level > 1 or v.alt) %} Alts: - True score: {{u.truecoins}}   - Coins spent: {{u.coins_spent}} {% endif %} {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

@@ -688,23 +690,24 @@ {% endif %}

 				

User ID: {{u.id}}

+

Coins spent: {{u.coins_spent}}

{% if v and v.admin_level > 1 %} +

True score: {{u.truecoins}}

{% if u.is_private %}

User has private mode enabled.

{% endif %} + {% endif %} + {% if v and (v.admin_level > 1 or v.alt) %} Alts: - True score: {{u.truecoins}}   - Coins spent: {{u.coins_spent}} {% endif %} {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

{% endif %} -