master
Aevann1 2021-11-18 22:50:03 +02:00
parent 7cab179f3c
commit 8a7aa2e25e
17 changed files with 92 additions and 23 deletions

View File

@ -50,6 +50,7 @@ class User(Base):
verified = Column(String)
verifiedcolor = Column(String)
marseyawarded = Column(Integer)
longpost = Column(Integer)
email = deferred(Column(String))
css = deferred(Column(String))
profilecss = deferred(Column(String))

View File

@ -194,6 +194,14 @@ AWARDS = {
"color": "text-black",
"price": 1000
},
"longpost": {
"kind": "longpost",
"title": "Longpost",
"description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.",
"icon": "fas fa-book",
"color": "text-green",
"price": 1000
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",
@ -374,6 +382,14 @@ AWARDS2 = {
"color": "text-black",
"price": 1000
},
"longpost": {
"kind": "longpost",
"title": "Longpost",
"description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.",
"icon": "fas fa-book",
"color": "text-green",
"price": 1000
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",

View File

@ -98,6 +98,16 @@ def shop(v):
"price": 1000,
"MB": True
},
"longpost": {
"kind": "longpost",
"title": "Longpost",
"description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.",
"icon": "fas fa-book",
"color": "text-green",
"owned": 0,
"price": 1000,
"MB": True
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",
@ -264,6 +274,14 @@ def buy(v, award):
"color": "text-black",
"price": 1000
},
"longpost": {
"kind": "longpost",
"title": "Longpost",
"description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.",
"icon": "fas fa-book",
"color": "text-green",
"price": 1000,
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",
@ -519,6 +537,8 @@ def award_post(pid, v):
g.db.add(new_badge)
elif kind == "marsey":
author.marseyawarded = time.time() + 86400
elif kind == "longpost":
author.longpost = time.time() + 86400
elif kind == "eye":
author.eye = True
send_notification(995, f"@{v.username} bought {kind} award!")
@ -648,6 +668,8 @@ def award_comment(cid, v):
g.db.add(new_badge)
elif kind == "marsey":
author.marseyawarded = time.time() + 86400
elif kind == "longpost":
author.longpost = time.time() + 86400
elif kind == "eye":
author.eye = True
send_notification(995, f"@{v.username} bought {kind} award!")

View File

@ -164,6 +164,12 @@ def api_comment(v):
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost:
if time.time() > v.longpost:
v.longpost = None
g.db.add(v)
elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
@ -188,6 +194,8 @@ def api_comment(v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
bans = filter_comment_html(body_html)
if bans:
@ -609,6 +617,12 @@ def edit_comment(cid, v):
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost:
if time.time() > v.longpost:
v.longpost = None
g.db.add(v)
elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE):
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
body_md = CustomRenderer().render(mistletoe.Document(body))
@ -616,6 +630,8 @@ def edit_comment(cid, v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
bans = filter_comment_html(body_html)
if bans:

View File

@ -234,6 +234,12 @@ def edit_post(pid, v):
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost:
if time.time() > v.longpost:
v.longpost = None
g.db.add(v)
elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
if title != p.title:
title_html = filter_title(title)
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 403
@ -257,6 +263,9 @@ def edit_post(pid, v):
p.body = body
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 40
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
p.body_html = body_html
if "rama" in request.host and "ivermectin" in body_html.lower():
@ -518,8 +527,12 @@ def submit_post(v):
title = request.values.get("title", "").strip()
url = request.values.get("url", "").strip()
title_html = filter_title(title)
body = request.values.get("body", "").strip()
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 40
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
if url:
if "/i.imgur.com/" in url: url = url.replace(".png", ".webp").replace(".jpg", ".webp").replace(".jpeg", ".webp")
elif "/media.giphy.com/" in url or "/c.tenor.com/" in url: url = url.replace(".gif", ".webp")
@ -590,8 +603,6 @@ def submit_post(v):
elif len(title) > 500:
if request.headers.get("Authorization"): return {"error": "500 character limit for titles"}, 400
else: render_template("submit.html", v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
body = request.values.get("body", "").strip()
if v.marseyawarded:
if time.time() > v.marseyawarded:
@ -604,6 +615,12 @@ def submit_post(v):
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost:
if time.time() > v.longpost:
v.longpost = None
g.db.add(v)
elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
dup = g.db.query(Submission).filter(
Submission.author_id == v.id,
Submission.deleted_utc == 0,
@ -685,6 +702,8 @@ def submit_post(v):
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400
if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403
if len(body_html) > 20000: return {"error":"Submission body too long!"}, 400
bans = filter_comment_html(body_html)

View File

@ -15,11 +15,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% 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=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
</head>

View File

@ -23,11 +23,6 @@
<div class="text-muted">{{award.owned}} owned</div>
</a>
{% endfor %}
<a class="card disabled d-md-none" style="border:none">
<i class="fas fa-volume-mute" style="opacity:0"></i>
<div class="pt-2" style="font-weight: bold; font-size: 14px; color:#E1E1E1">&nbsp;</div>
<div class="text-muted">&nbsp;</div>
</a>
</div>
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<input id="kind" name="kind" value="" hidden>

View File

@ -27,7 +27,7 @@
{% if v %}
{% include "award_modal.html" %}
<script src="https://cdn.jsdelivr.net/npm/marked@3.0.8/lib/marked.min.js"></script>
<script src="/assets/js/comments_v.js?v=69"></script>
<script src="/assets/js/comments_v.js?v=70"></script>
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>

View File

@ -254,12 +254,12 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% 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=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
{% endblock %}

View File

@ -17,11 +17,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% 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=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% 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=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
</head>

View File

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

View File

@ -40,10 +40,10 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% 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=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
</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=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
</head>

View File

@ -146,7 +146,7 @@
</script>
{% if v %}
<script src="/assets/js/comments_v.js?v=69"></script>
<script src="/assets/js/comments_v.js?v=70"></script>
{% include "award_modal.html" %}
{% include "emoji_modal.html" %}
{% include "gif_modal.html" %}

View File

@ -31,11 +31,11 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% 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=117">
<link rel="stylesheet" href="/assets/css/main.css?v=118">
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
{% endblock %}