remotes/1693045480750635534/spooky-22
Aevann1 2022-01-14 01:29:15 +02:00
parent 837410187c
commit 6ecf15476a
19 changed files with 47 additions and 31 deletions

View File

@ -342,8 +342,8 @@ class Submission(Base):
if v.teddit: url = self.url.replace("old.reddit.com", "teddit.net")
elif not v.oldreddit: url = self.url.replace("old.reddit.com", "reddit.com")
if '/comments/' in url and "sort=" not in url:
if "?" in url: url += "&context=99"
else: url += "?context=99"
if "?" in url: url += "&context=9"
else: url += "?context=9"
if v.controversial: url += "&sort=controversial"
return url
elif self.url:

View File

@ -561,6 +561,11 @@ class User(Base):
def applications(self):
return g.db.query(OauthApp).filter_by(author_id=self.id).order_by(OauthApp.id)
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
@lazy
def subscribed_idlist(self, page=1):
posts = g.db.query(Subscription.submission_id).filter_by(user_id=self.id).all()

View File

@ -879,26 +879,29 @@ def ban_user(user_id, v):
user = g.db.query(User).filter_by(id=user_id).one_or_none()
if not user: abort(404)
if user.admin_level >= v.admin_level: abort(403)
days = float(request.values.get("days")) if request.values.get('days') else 0
reason = sanitize(request.values.get("reason", ""))[:256]
message = request.values.get("reason", "").strip()[:256]
if not user: abort(400)
reason = request.values.get("reason", "").strip()[:256]
passed_reason = filter_emojis_only(reason)
user.ban(admin=v, reason=reason, days=days)
if len(passed_reason) > 256: passed_reason = reason
user.ban(admin=v, reason=passed_reason, days=days)
if request.values.get("alts"):
for x in user.alts:
if x.admin_level: break
user.ban(admin=v, reason=reason, days=days)
user.ban(admin=v, reason=passed_reason, days=days)
if days:
if message: text = f"Your account has been suspended for {days} days for the following reason:\n\n> {message}"
if reason: text = f"Your account has been suspended for {days} days for the following reason:\n\n> {reason}"
else: text = f"Your account has been suspended for {days} days."
else:
if message: text = f"Your account has been permanently suspended for the following reason:\n\n> {message}"
if reason: text = f"Your account has been permanently suspended for the following reason:\n\n> {reason}"
else: text = "Your account has been permanently suspended."
send_repeatable_notification(user.id, text)

View File

@ -274,6 +274,7 @@ def contact(v):
@app.post("/send_admin")
@limiter.limit("1/second")
@limiter.limit("6/hour")
@auth_required
def submit_contact(v):
message = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + request.values.get("message", "")

View File

@ -479,6 +479,7 @@ def message2(v, username):
@app.post("/reply")
@limiter.limit("1/second")
@limiter.limit("6/minute")
@limiter.limit("50/hour")
@auth_required
def messagereply(v):

View File

@ -28,7 +28,7 @@ def admin_vote_info_get(v):
if isinstance(thing, Submission):
if thing.author.shadowbanned and not (v and v.admin_level):
thing_id = g.db.query(Submission.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).first()[0]
thing_id = g.db.query(Submission.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Submission.id).first()[0]
else: thing_id = thing.id
ups = g.db.query(Vote
@ -44,7 +44,7 @@ def admin_vote_info_get(v):
elif isinstance(thing, Comment):
if thing.author.shadowbanned and not (v and v.admin_level):
thing_id = g.db.query(Comment.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).first()[0]
thing_id = g.db.query(Comment.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Comment.id).first()[0]
else: thing_id = thing.id
ups = g.db.query(CommentVote

View File

@ -15,7 +15,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %}
<style>
html {
@ -39,7 +39,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %}
</head>

View File

@ -1,3 +1,9 @@
{% if comment_info and not request.full_path.endswith('#context') %}
<script data-cfasync="false">
history.pushState(null, null, '#context');
</script>
{% endif %}
{% if v %}
{% include "award_modal.html" %}
{% endif %}

View File

@ -7,7 +7,7 @@
<script src="/static/assets/js/bootstrap.js?a=3"></script>
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73">
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %}
<style>
@ -32,7 +32,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %}
<meta charset="utf-8">

View File

@ -6,7 +6,7 @@
{% block content %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %}
<style>
html {
@ -30,7 +30,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %}
<div class="row justify-content-around">

View File

@ -18,7 +18,7 @@
{% endblock %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73">
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head>

View File

@ -14,7 +14,7 @@
<title>2-Step Login - {{'SITE_NAME' | app_config}}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head>

View File

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %}
<style>
html {

View File

@ -39,10 +39,10 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %}
</head>

View File

@ -31,7 +31,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head>

View File

@ -32,7 +32,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
</head>

View File

@ -26,7 +26,7 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=11">
{% if v.agendaposter %}
<style>
html {
@ -50,7 +50,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?a=72">
<link rel="stylesheet" href="/static/assets/css/main.css?a=73">
<link rel="stylesheet" href="/static/assets/css/{{'DEFAULT_THEME' | app_config}}.css?a=3">
{% endif %}
{% endblock %}

View File

@ -42,12 +42,12 @@
</div>
<div id="profilestuff" class="ml-3 w-100">
{% if u.is_suspended %}
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}:
<h5 class="text-primary">BANNED USER{% if u.ban_reason %}:
{% if u.ban_reason_link %}<a href="{{ u.ban_reason_link }}"><i class="fas fa-link"></i>{% endif %}
{{ u.ban_reason }}
{% if u.ban_reason_link %}</a>{% endif %}
{% endif %}</h5>
{% if u.unban_utc %}<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>{% endif %}
{% if u.unban_utc %}<h5 class="text-primary">>{{u.unban_string}}</h5>{% endif %}
{% endif %}
<div class="d-flex align-items-center mt-1 mb-2">
<h1 class="font-weight-bolder h3 mb-0" style="color: #{{u.namecolor}}"><span {% if u.patron %}class="patron" style="background-color:#{{u.namecolor}}"{% endif %}>{{u.username}}</span></h1>
@ -346,8 +346,8 @@
</div>
<div class="mt-n3 py-3">
{% if u.is_suspended %}
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
{% if u.unban_utc %}<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>{% endif %}
<h5 class="text-primary">>BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
{% if u.unban_utc %}<h5 class="text-primary">>{{u.unban_string}}</h5>{% endif %}
{% endif %}
{% if u.verified %}<span><i class="fas fa-badge-check align-middle ml-1" style="color:{% if u.verifiedcolor %}#{{u.verifiedcolor}}{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="{{u.verified}}"></i></span>&nbsp;{% endif %}
<a class="text-black"><h1 class="h5 d-inline-block" style="color: #{{u.namecolor}}"><span {% if u.patron %}class="patron" style="background-color:#{{u.namecolor}}"{% endif %}>{{u.username}}</span></h1></a>

View File

@ -14,7 +14,7 @@
<h1>Info</h1>
<p><a href="{{thing.permalink}}">{{thing.permalink}}</a></p>
<p><b>Author:</b> <a href="{{thing.author.url}}">@{{thing.author.username}}</a></p>
<p><b>Author Created At:</b> {{thing.author.created_utc}} ({{thing.author.created_datetime}})</p>
<p><b>Author Created At:</b> ({{thing.author.created_datetime}})</p>
<p><b>Upvotes: </b>{{ups | length}}</p>
<p><b>Downvotes: </b>{{downs | length}}</p>