train award

remotes/1693045480750635534/spooky-22
Aevann1 2021-10-20 21:34:56 +02:00
parent 37c4129b08
commit 6a08b2a410
15 changed files with 142 additions and 50 deletions

View File

@ -10,7 +10,7 @@ if site_name == "Drama":
AWARDS = {
"ban": {
"kind": "ban",
"title": "One-Day Ban",
"title": "1-Day Ban",
"description": "Bans the author for a day.",
"icon": "fas fa-gavel",
"color": "text-danger",
@ -39,7 +39,15 @@ if site_name == "Drama":
"icon": "fas fa-seedling",
"color": "text-success",
"price": 10000
}
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
},
}
else:
AWARDS = {
@ -58,6 +66,14 @@ else:
"icon": "fas fa-sparkles",
"color": "text-warning",
"price": 500
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}

View File

@ -27,7 +27,7 @@ if site_name == "Drama":
AWARDS = {
"ban": {
"kind": "ban",
"title": "One-Day Ban",
"title": "1-Day Ban",
"description": "Bans the author for a day.",
"icon": "fas fa-gavel",
"color": "text-danger",
@ -56,6 +56,14 @@ if site_name == "Drama":
"icon": "fas fa-seedling",
"color": "text-success",
"price": 10000
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}
else:
@ -75,6 +83,14 @@ else:
"icon": "fas fa-sparkles",
"color": "text-warning",
"price": 500
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}

View File

@ -14,7 +14,7 @@ def shop(v):
AWARDS = {
"ban": {
"kind": "ban",
"title": "One-Day Ban",
"title": "1-Day Ban",
"description": "Bans the author for a day.",
"icon": "fas fa-gavel",
"color": "text-danger",
@ -43,6 +43,14 @@ def shop(v):
"icon": "fas fa-seedling",
"color": "text-success",
"price": 10000
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}
else:
@ -62,6 +70,14 @@ def shop(v):
"icon": "fas fa-sparkles",
"color": "text-warning",
"price": 500
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}
@ -99,7 +115,7 @@ def buy(v, award):
AWARDS = {
"ban": {
"kind": "ban",
"title": "One-Day Ban",
"title": "1-Day Ban",
"description": "Bans the author for a day.",
"icon": "fas fa-gavel",
"color": "text-danger",
@ -128,6 +144,14 @@ def buy(v, award):
"icon": "fas fa-seedling",
"color": "text-success",
"price": 10000
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}
else:
@ -147,6 +171,14 @@ def buy(v, award):
"icon": "fas fa-sparkles",
"color": "text-warning",
"price": 500
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"price": 500
}
}
@ -175,13 +207,6 @@ def buy(v, award):
return {"message": "Award bought!"}
ALLOW_MULTIPLE = (
"ban",
"shit",
"fireflies",
"grass"
)
@app.post("/post/<pid>/awards")
@limiter.limit("1/second")
@auth_required
@ -222,9 +247,6 @@ def award_post(pid, v):
)
).first()
if existing_award and kind not in ALLOW_MULTIPLE:
return {"error": "You can't give that award multiple times to the same post."}, 409
post_award.submission_id = post.id
g.db.add(post_award)
@ -240,7 +262,7 @@ def award_post(pid, v):
link = f"[this post]({post.permalink})"
if not author.is_suspended:
author.ban(reason=f"one-day ban award used by @{v.username} on /post/{post.id}", days=1)
author.ban(reason=f"1-Day ban award used by @{v.username} on /post/{post.id}", days=1)
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for a day for {link}. It sucked and you should feel bad.")
elif author.unban_utc > 0:
author.unban_utc += 24*60*60
@ -302,9 +324,6 @@ def award_comment(cid, v):
)
).first()
if existing_award and kind not in ALLOW_MULTIPLE:
return {"error": "You can't give that award multiple times to the same comment."}, 409
comment_award.comment_id = c.id
g.db.add(comment_award)
@ -321,7 +340,7 @@ def award_comment(cid, v):
link = f"[this comment]({c.permalink})"
if not author.is_suspended:
author.ban(reason=f"one-day ban award used by @{v.username} on /comment/{c.id}", days=1)
author.ban(reason=f"1-Day ban award used by @{v.username} on /comment/{c.id}", days=1)
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for a day for {link}. It sucked and you should feel bad.")
elif author.unban_utc > 0:
author.unban_utc += 24*60*60

View File

@ -15,11 +15,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=80">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=80">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
{% endif %}
</head>

View File

@ -54,7 +54,7 @@
opacity: 0.6;
}
.awards-wrapper a:hover, .picked {
.awards-wrapper a:hover, .awards-wrapper .picked {
background-color: var(--primary)!important;
}
@ -64,7 +64,7 @@
@media (min-width: 767.98px) {
.award-columns {
column-count: 4 !important;
column-count: 5 !important;
}
}
</style>

View File

@ -250,12 +250,12 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=80">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=80">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=82">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
{% endif %}
{% endblock %}

View File

@ -6,13 +6,6 @@
font-size: 13px !important;
}
@media (min-width: 576px)
{
.modal-dialog {
max-width: 65% !important;
margin: 1.75rem auto !important;
}
}
.emoji2:focus {
border: 1px solid var(--primary) !important;
}

View File

@ -17,11 +17,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=80">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=80">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
{% endif %}
<div class="row justify-content-around">

View File

@ -12,7 +12,7 @@
<title>2-Step Login - {{'SITE_NAME' | app_config}}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
</head>

View File

@ -55,8 +55,8 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=80">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=80">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link href="/assets/css/fa.css?v=52" rel="stylesheet">
</head>

View File

@ -40,10 +40,10 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
{% endif %}
<link href="/assets/css/fa.css?v=52" rel="stylesheet">

View File

@ -36,7 +36,7 @@
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
</head>

View File

@ -31,7 +31,7 @@
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
</head>

View File

@ -13,6 +13,54 @@
{% block title %}
{% if p.award_count("train") %}
<style>
@keyframes train {
0% {
left: -10%;
}
100% {
left: 110%;
}
}
@keyframes trainrev {
0% {
left: 110%;
}
100% {
left: -10%;
}
}
.train {
position: absolute;
width: 100px;
z-index: 10;
animation: train 5s linear infinite !important;
}
.trainrev {
animation: trainrev 5s linear infinite !important;
}
</style>
<img class="train" style="top:10%" src="/assets/images/emojis/marseytrain.webp">
{% endif %}
{% if p.award_count("train") > 1 %}
<img class="train trainrev mirrored" style="top:35%" src="/assets/images/emojis/marseytrain.webp">
{% endif %}
{% if p.award_count("train") > 2 %}
<img class="train" style="top:60%" src="/assets/images/emojis/marseytrain.webp">
{% endif %}
{% if p.award_count("train") > 3 %}
<img class="train trainrev mirrored" style="top:85%" src="/assets/images/emojis/marseytrain.webp">
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
<script src="/assets/js/new_comments_count.js?v=53"></script>

View File

@ -25,12 +25,12 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=80">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=80">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=82"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=82">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=82">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=80">
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=80">
<link rel="stylesheet" href="/assets/css/main.css?v=82">
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=82">
{% endif %}
{% endblock %}