diff --git a/files/classes/award.py b/files/classes/award.py index 8e823e90a..9d3b7ef4b 100755 --- a/files/classes/award.py +++ b/files/classes/award.py @@ -24,6 +24,14 @@ if site_name == "Drama": "color": "text-success", "price": 3500 }, + "grass": { + "kind": "grass", + "title": "Grass", + "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", + "icon": "fas fa-seedling", + "color": "text-success", + "price": 10000 + }, "shit": { "kind": "shit", "title": "Shit", @@ -35,19 +43,11 @@ if site_name == "Drama": "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 }, - "grass": { - "kind": "grass", - "title": "Grass", - "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", - "icon": "fas fa-seedling", - "color": "text-success", - "price": 10000 - }, "train": { "kind": "train", "title": "Train", @@ -60,7 +60,7 @@ if site_name == "Drama": "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -68,7 +68,7 @@ if site_name == "Drama": "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, @@ -86,7 +86,7 @@ else: "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 @@ -103,7 +103,7 @@ else: "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -111,7 +111,7 @@ else: "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 1e097c269..23a9caafd 100755 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -175,22 +175,22 @@ ACTIONTYPES={ }, "pin_comment":{ "str":'pinned a {self.target_link}', - "icon":"fa-thumbtack", + "icon":"fa-thumbtack fa-rotate--45", "color": "bg-info", }, "unpin_comment":{ "str":'un-pinned a {self.target_link}', - "icon":"fa-thumbtack", + "icon":"fa-thumbtack fa-rotate--45", "color": "bg-muted", }, "pin_post":{ "str":'pinned post {self.target_link}', - "icon":"fa-thumbtack", + "icon":"fa-thumbtack fa-rotate--45", "color": "bg-success", }, "unpin_post":{ "str":'un-pinned post {self.target_link}', - "icon":"fa-thumbtack", + "icon":"fa-thumbtack fa-rotate--45", "color": "bg-muted", }, "set_nsfw":{ diff --git a/files/classes/user.py b/files/classes/user.py index b6400e8e3..bf55bc69b 100755 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -41,6 +41,14 @@ if site_name == "Drama": "color": "text-success", "price": 3500 }, + "grass": { + "kind": "grass", + "title": "Grass", + "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", + "icon": "fas fa-seedling", + "color": "text-success", + "price": 10000 + }, "shit": { "kind": "shit", "title": "Shit", @@ -52,19 +60,11 @@ if site_name == "Drama": "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 }, - "grass": { - "kind": "grass", - "title": "Grass", - "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", - "icon": "fas fa-seedling", - "color": "text-success", - "price": 10000 - }, "train": { "kind": "train", "title": "Train", @@ -77,7 +77,7 @@ if site_name == "Drama": "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -85,7 +85,7 @@ if site_name == "Drama": "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, @@ -103,7 +103,7 @@ else: "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 @@ -120,7 +120,7 @@ else: "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -128,7 +128,7 @@ else: "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, diff --git a/files/routes/admin.py b/files/routes/admin.py index cad3fabad..ad5af2ff4 100755 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1064,19 +1064,6 @@ def api_sticky_post(post_id, v): if post.stickied: return {"message": "Post pinned!"} else: return {"message": "Post unpinned!"} -@app.post("/pin/") -@auth_required -def api_pin_post(post_id, v): - - post = g.db.query(Submission).options(lazyload('*')).filter_by(id=post_id).first() - if post: - post.is_pinned = not post.is_pinned - g.db.add(post) - g.db.commit() - - if post.is_pinned: return {"message": "Post pinned!"} - else: return {"message": "Post unpinned!"} - @app.post("/ban_comment/") @limiter.limit("1/second") @admin_level_required(1) diff --git a/files/routes/awards.py b/files/routes/awards.py index 9f70e06bc..45c419274 100755 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -29,6 +29,14 @@ def shop(v): "color": "text-success", "price": 3500 }, + "grass": { + "kind": "grass", + "title": "Grass", + "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", + "icon": "fas fa-seedling", + "color": "text-success", + "price": 10000 + }, "shit": { "kind": "shit", "title": "Shit", @@ -40,19 +48,11 @@ def shop(v): "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 }, - "grass": { - "kind": "grass", - "title": "Grass", - "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", - "icon": "fas fa-seedling", - "color": "text-success", - "price": 10000 - }, "train": { "kind": "train", "title": "Train", @@ -65,7 +65,7 @@ def shop(v): "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -73,7 +73,7 @@ def shop(v): "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, @@ -91,7 +91,7 @@ def shop(v): "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 @@ -108,7 +108,7 @@ def shop(v): "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -116,12 +116,39 @@ def shop(v): "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, } + AWARDS2 = { + "ban": { + "kind": "ban", + "title": "1-Day Ban", + "description": "Bans the author for a day.", + "icon": "fas fa-gavel", + "color": "text-danger", + "price": 3000 + }, + "grass": { + "kind": "grass", + "title": "Grass", + "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", + "icon": "fas fa-seedling", + "color": "text-success", + "price": 10000 + }, + "shit": { + "kind": "shit", + "title": "Shit", + "description": "Makes flies swarm a post.", + "icon": "fas fa-poop", + "color": "text-black-50", + "price": 500 + }, + } + query = g.db.query( User.id, User.username, User.patron, User.namecolor, AwardRelationship.kind.label('last_award_kind'), func.count(AwardRelationship.id).label('last_award_count') @@ -171,6 +198,14 @@ def buy(v, award): "color": "text-success", "price": 3500 }, + "grass": { + "kind": "grass", + "title": "Grass", + "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", + "icon": "fas fa-seedling", + "color": "text-success", + "price": 10000 + }, "shit": { "kind": "shit", "title": "Shit", @@ -182,19 +217,11 @@ def buy(v, award): "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 }, - "grass": { - "kind": "grass", - "title": "Grass", - "description": "Ban the author permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", - "icon": "fas fa-seedling", - "color": "text-success", - "price": 10000 - }, "train": { "kind": "train", "title": "Train", @@ -207,7 +234,7 @@ def buy(v, award): "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -215,7 +242,7 @@ def buy(v, award): "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, @@ -233,7 +260,7 @@ def buy(v, award): "fireflies": { "kind": "fireflies", "title": "Fireflies", - "description": "Puts stars on the post.", + "description": "Puts fireflies on the post.", "icon": "fas fa-sparkles", "color": "text-warning", "price": 500 @@ -250,7 +277,7 @@ def buy(v, award): "kind": "pin", "title": "1-Hour Pin", "description": "Pins the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-warning", "price": 750 }, @@ -258,7 +285,7 @@ def buy(v, award): "kind": "unpin", "title": "1-Hour Unpin", "description": "Removes 1 hour from the pin duration of the post.", - "icon": "fas fa-thumbtack", + "icon": "fas fa-thumbtack fa-rotate--45", "color": "text-black", "price": 1000 }, @@ -357,7 +384,6 @@ def award_post(pid, v): author.unban_utc = 0 author.is_banned = 0 send_notification(NOTIFICATIONS_ACCOUNT, author, f"You have been unbanned!") - elif kind == "grass": author = post.author author.is_banned = AUTOJANNY_ACCOUNT @@ -461,6 +487,17 @@ def award_comment(cid, v): author.ban_reason = f"grass award used by @{v.username} on /comment/{c.id}" link = f"[this comment]({c.permalink})" send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!") + elif kind == "pin": + if c.is_pinned and c.is_pinned.startswith("t:"): t = int(c.is_pinned[2:]) + 3600 + else: t = int(time.time()) + 3600 + c.is_pinned = f"t:{t}" + g.db.add(c) + elif kind == "unpin": + if not (c.is_pinned and c.is_pinned.startswith("t:")): abort(403) + t = int(c.is_pinned[2:]) - 3600 + if time.time() > t: c.is_pinned = None + else: c.is_pinned = f"t:{t}" + g.db.add(c) c.author.received_award_count += 1 g.db.add(c.author) @@ -473,7 +510,7 @@ def award_comment(cid, v): @admin_level_required(6) def admin_userawards_get(v): - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) + return render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) @app.post("/admin/awards") @limiter.limit("1/second") @@ -523,4 +560,4 @@ def admin_userawards_post(v): g.db.commit() - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file + return render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index 4c718841d..e24365829 100755 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -810,10 +810,11 @@ def toggle_pin_comment(cid, v): comment = get_comment(cid, v=v) - if v.admin_level < 1 and v.id != comment.post.author_id: - abort(403) + if v.admin_level < 1 and v.id != comment.post.author_id: abort(403) - if comment.is_pinned: comment.is_pinned = None + if comment.is_pinned: + if comment.is_pinned.startswith("t:"): abort(403) + else: comment.is_pinned = None else: comment.is_pinned = v.username g.db.add(comment) diff --git a/files/routes/posts.py b/files/routes/posts.py index 5ccac7f48..5fe259418 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1003,3 +1003,16 @@ def unsave_post(pid, v): g.db.commit() return {"message": "Post unsaved!"} + +@app.post("/pin/") +@auth_required +def api_pin_post(post_id, v): + + post = g.db.query(Submission).options(lazyload('*')).filter_by(id=post_id).first() + if post: + post.is_pinned = not post.is_pinned + g.db.add(post) + g.db.commit() + + if post.is_pinned: return {"message": "Post pinned!"} + else: return {"message": "Post unpinned!"} \ No newline at end of file diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 7d6a6b969..1db575888 100755 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -28,11 +28,6 @@ -
-
-
-
-					
@@ -67,6 +62,10 @@ background-color: var(--primary)!important; } + .award-columns { + column-count: 2; + } + @media (min-width: 767.98px) { .award-columns { column-count: 8 !important; diff --git a/files/templates/comments.html b/files/templates/comments.html index d79b4554d..8ffa37c63 100755 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -26,7 +26,7 @@ {% if v %} {% include "award_modal.html" %} - + {% endif %} @@ -119,7 +119,7 @@
- {% if c.author.bio_html %}{{c.author.bio_html | safe}}{% endif %} + {% if c.author.bio_html %}{{c.author.bio_html.replace('src="/assets/images/loading.gif" data-', '') | safe}}{% endif %}
@@ -263,14 +263,14 @@ {% if c.active_flags %}{{c.active_flags}} Reports{% endif %} {% if c.over_18 %}+18{% endif %} {% if v and v.admin_level==6 and c.author.shadowbanned %}{% endif %} - {% if c.is_pinned %}{% endif %} + {% if c.is_pinned %}{% endif %} {% if c.distinguish_level %}{% endif %} {% if c.is_op %}{% endif %} {% if c.is_bot %}{% endif %} {% if c.is_blocking %}{% endif %} {% if c.is_blocked %}{% endif %} - {% if c.author.verified %} + {% if c.author.verified %} {% endif %} {{c.author.username}} @@ -435,9 +435,9 @@ {% endif %} {% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %} - Unpin + Unpin - Pin + Pin {% endif %} @@ -579,8 +579,8 @@ {% endif %} {% if v and c.post and (v.admin_level >= 1 or v.id == c.post.author_id) and c.level == 1 %} - Pin - Unpin + Pin + Unpin {% endif %} {% if v %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 1a412193e..5152d3913 100755 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -143,7 +143,7 @@ {% if v %} - + {% include "award_modal.html" %} {% include "emoji_modal.html" %} {% include "gif_modal.html" %} @@ -264,7 +264,7 @@
- {% if p.author.bio_html %}{{p.author.bio_html | safe}}{% endif %} + {% if p.author.bio_html %}{{p.author.bio_html.replace('src="/assets/images/loading.gif" data-', '') | safe}}{% endif %}
@@ -308,8 +308,8 @@ - - + + {% if p.deleted_utc > 0 %} @@ -340,8 +340,8 @@ {% endif %} {% if v.admin_level >=3 %} - - + + {% if v==p.author %} @@ -417,14 +417,14 @@ {% endfor %} {% endif %} {% if v and v.admin_level==6 and p.author.shadowbanned %}{% endif %} - {% if p.stickied %}{% endif %} - {% if p.is_pinned %}{% endif %} + {% if p.stickied %}{% endif %} + {% if p.is_pinned %}{% endif %} {% if p.distinguish_level %} {% endif %} {% if p.is_bot %} {% endif %} {% if p.over_18 %}+18{% endif %} {% if p.private %}Draft{% endif %} {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} - {% if p.author.verified %} + {% if p.author.verified %} {% endif %} {{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}  {{p.age_string}} @@ -593,8 +593,8 @@ Report {% if v and v.id==p.author_id %} - Pin to profile - Unpin from profile + Pin to profile + Unpin from profile {% if p.deleted_utc > 0 %} Undelete @@ -603,8 +603,8 @@ {% endif %} {% endif %} {% if v and v.admin_level>=3 %} - Pin - Unpin + Pin + Unpin {% if v==p.author %} Distinguish Undistinguish diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index c15c3af1a..966dad91e 100755 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -44,7 +44,7 @@
- {% if p.author.bio_html %}{{p.author.bio_html | safe}}{% endif %} + {% if p.author.bio_html %}{{p.author.bio_html.replace('src="/assets/images/loading.gif" data-', '') | safe}}{% endif %}
@@ -183,16 +183,16 @@ {% endfor %} {% endif %} {% if v and v.admin_level==6 and p.author.shadowbanned %}{% endif %} - {% if p.stickied %}{% endif %} + {% if p.stickied %}{% endif %} {% if p.distinguish_level %}{% endif %} - {% if p.is_pinned and request.path.startswith('/@') %}{% endif %} + {% if p.is_pinned and request.path.startswith('/@') %}{% endif %} {% if p.over_18 %}+18{% endif %} {% if p.is_bot %} {% endif %} {% if p.is_blocking %}{% endif %} {% if p.is_blocked %}{% endif %} {% if p.private %}Draft{% endif %} {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} - {% if p.author.verified %} + {% if p.author.verified %} {% endif %} {{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}  {{p.age_string}} @@ -239,8 +239,8 @@ Report {% if v and v.id==p.author_id %} - Pin to profile - Unpin from profile + Pin to profile + Unpin from profile {% if p.deleted_utc > 0 %} Undelete @@ -250,8 +250,8 @@ {% endif %} {% if v and v.admin_level>=3 %} - Pin - Unpin + Pin + Unpin {% if v==p.author %} Distinguish Undistinguish @@ -386,8 +386,8 @@ {% endif %} - - + + {% if p.deleted_utc > 0 %} @@ -418,8 +418,8 @@ {% endif %} {% if v.admin_level >=3 %} - - + + {% if v==p.author %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index cae0de909..9a4772aed 100755 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -87,7 +87,7 @@ {% endif %} - {% if u.verified %}{% endif %} + {% if u.verified %}{% endif %} {% if u.admin_level > 1 or (u.admin_level == 1 and (not v or v.admin_level < 2)) %} @@ -362,7 +362,7 @@
BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}
{% if u.unban_utc %}
{{u.unban_string}}
{% endif %} {% endif %} - {% if u.verified %} {% endif %} + {% if u.verified %} {% endif %}

{{u.username}}

{% if u.username != u.original_username %}