diff --git a/files/__main__.py b/files/__main__.py index ecf7f252b..78fad7d14 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -48,9 +48,9 @@ app.config["SESSION_COOKIE_SAMESITE"] = "Lax" app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 * 365 app.config["SESSION_REFRESH_EACH_REQUEST"] = True -app.config["SLOGAN"] = environ.get("SLOGAN").strip() -app.config["DEFAULT_COLOR"] = environ.get("DEFAULT_COLOR").strip() -app.config["DEFAULT_THEME"] = environ.get("DEFAULT_THEME").strip() + "_" + environ.get("DEFAULT_COLOR").strip() +app.config["SLOGAN"] = environ.get("SLOGAN", "").strip() +app.config["DEFAULT_COLOR"] = environ.get("DEFAULT_COLOR", "ff0000").strip() +app.config["DEFAULT_THEME"] = environ.get("DEFAULT_THEME", "light").strip() + "_" + environ.get("DEFAULT_COLOR", "ff0000").strip() app.config["FORCE_HTTPS"] = int(environ.get("FORCE_HTTPS", 1)) if ("localhost" not in app.config["SERVER_NAME"] and "127.0.0.1" not in app.config["SERVER_NAME"]) else 0 @@ -107,7 +107,7 @@ app.config["RATELIMIT_HEADERS_ENABLED"]=True limiter = Limiter( app, key_func=get_ipaddr, - default_limits=["100/minute"], + #default_limits=["100/minute"], headers_enabled=True, strategy="fixed-window" ) diff --git a/files/classes/award.py b/files/classes/award.py index c1de3fe0f..a92462396 100644 --- a/files/classes/award.py +++ b/files/classes/award.py @@ -20,6 +20,13 @@ if site_name == "Drama": "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", "icon": "fas fa-poop", "color": "text-black-50" + }, + "gold": { + "kind": "gold", + "title": "Gold", + "description": "A positive award because we need a positive award. Puts annoying sparkles in the post.", + "icon": "fas fa-sparkles", + "color": "text-warning" } } else: diff --git a/files/classes/comment.py b/files/classes/comment.py index 1016991bd..61b5002b1 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -172,6 +172,8 @@ class Comment(Base, Age_times, Scores, Stndrd, Fuzzing): return data + def award_count(self, kind) -> int: + return len([x for x in self.awards if x.kind == kind]) @property def json_core(self): diff --git a/files/routes/awards.py b/files/routes/awards.py index 1402a5da1..512072e81 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -29,7 +29,8 @@ ACTIONS = { ALLOW_MULTIPLE = ( "ban", - "shit" + "shit", + "gold" ) diff --git a/files/templates/comments.html b/files/templates/comments.html index e0aeb4e58..cc50ce62e 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -15,8 +15,6 @@ {% if (c.is_banned or c.deleted_utc > 0 or c.is_blocking or c.is_blocked) and not (v and v.admin_level>0) and not (v and v.id==c.author_id) %} - -
diff --git a/files/templates/submission.html b/files/templates/submission.html index 99bcd403e..e4ac4b825 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -190,9 +190,43 @@ {% endif %} + + +{% if p.award_count("gold") %} +{% set sparkles = 10*p.award_count("gold") if p.award_count("gold") <= 5 else 50 %} + + +{% endif %} +
-
+
@@ -278,7 +312,9 @@ {% endif %} {% endif %} - {{p.realbody(v) | safe}} +
+ {{p.realbody(v) | safe}} +
{% if p.domain == "twitter.com" and (v and v.theme.split("_")[0] in ["light", "coffee", "4chan"]) %} {% include "embeds/twitterlight.html" %}