sex
This commit is contained in:
parent
7978ba9309
commit
b1e4b8849a
6 changed files with 62 additions and 13 deletions
|
@ -65,11 +65,11 @@ app.config["HCAPTCHA_SITEKEY"] = environ.get("HCAPTCHA_SITEKEY","").strip()
|
||||||
app.config["HCAPTCHA_SECRET"] = environ.get("HCAPTCHA_SECRET","").strip()
|
app.config["HCAPTCHA_SECRET"] = environ.get("HCAPTCHA_SECRET","").strip()
|
||||||
|
|
||||||
# antispam configs
|
# antispam configs
|
||||||
app.config["SPAM_SIMILARITY_THRESHOLD"] = float(environ.get("SPAM_SIMILARITY_THRESHOLD"))
|
app.config["SPAM_SIMILARITY_THRESHOLD"] = float(environ.get("SPAM_SIMILARITY_THRESHOLD", 0.5))
|
||||||
app.config["SPAM_SIMILAR_COUNT_THRESHOLD"] = int(environ.get("SPAM_SIMILAR_COUNT_THRESHOLD"))
|
app.config["SPAM_SIMILAR_COUNT_THRESHOLD"] = int(environ.get("SPAM_SIMILAR_COUNT_THRESHOLD", 5))
|
||||||
app.config["SPAM_URL_SIMILARITY_THRESHOLD"] = float(environ.get("SPAM_URL_SIMILARITY_THRESHOLD"))
|
app.config["SPAM_URL_SIMILARITY_THRESHOLD"] = float(environ.get("SPAM_URL_SIMILARITY_THRESHOLD", 0.5))
|
||||||
app.config["COMMENT_SPAM_SIMILAR_THRESHOLD"] = float(environ.get("COMMENT_SPAM_SIMILAR_THRESHOLD"))
|
app.config["COMMENT_SPAM_SIMILAR_THRESHOLD"] = float(environ.get("COMMENT_SPAM_SIMILAR_THRESHOLD", 0.5))
|
||||||
app.config["COMMENT_SPAM_COUNT_THRESHOLD"] = int(environ.get("COMMENT_SPAM_COUNT_THRESHOLD"))
|
app.config["COMMENT_SPAM_COUNT_THRESHOLD"] = int(environ.get("COMMENT_SPAM_COUNT_THRESHOLD", 0.5))
|
||||||
|
|
||||||
app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL").strip()
|
app.config["CACHE_REDIS_URL"] = environ.get("REDIS_URL").strip()
|
||||||
app.config["CACHE_DEFAULT_TIMEOUT"] = 60
|
app.config["CACHE_DEFAULT_TIMEOUT"] = 60
|
||||||
|
@ -83,7 +83,7 @@ redispool=ConnectionPool(
|
||||||
) if app.config["CACHE_TYPE"]=="redis" else None
|
) if app.config["CACHE_TYPE"]=="redis" else None
|
||||||
app.config["CACHE_OPTIONS"]={'connection_pool':redispool} if app.config["CACHE_TYPE"]=="redis" else {}
|
app.config["CACHE_OPTIONS"]={'connection_pool':redispool} if app.config["CACHE_TYPE"]=="redis" else {}
|
||||||
|
|
||||||
app.config["READ_ONLY"]=bool(int(environ.get("READ_ONLY")))
|
app.config["READ_ONLY"]=bool(int(environ.get("READ_ONLY", "0")))
|
||||||
app.config["BOT_DISABLE"]=bool(int(environ.get("BOT_DISABLE", False)))
|
app.config["BOT_DISABLE"]=bool(int(environ.get("BOT_DISABLE", False)))
|
||||||
|
|
||||||
app.config["TENOR_KEY"]=environ.get("TENOR_KEY",'').strip()
|
app.config["TENOR_KEY"]=environ.get("TENOR_KEY",'').strip()
|
||||||
|
|
|
@ -7,6 +7,7 @@ from files.helpers.images import *
|
||||||
from .alts import Alt
|
from .alts import Alt
|
||||||
from .submission import SaveRelationship
|
from .submission import SaveRelationship
|
||||||
from .comment import Notification
|
from .comment import Notification
|
||||||
|
from .award import AwardRelationship
|
||||||
from .subscriptions import *
|
from .subscriptions import *
|
||||||
from .userblock import *
|
from .userblock import *
|
||||||
from .badges import *
|
from .badges import *
|
||||||
|
@ -314,6 +315,29 @@ class User(Base, Stndrd, Age_times):
|
||||||
|
|
||||||
return sorted(list(awards.values()), key=lambda x: x['kind'], reverse=True)
|
return sorted(list(awards.values()), key=lambda x: x['kind'], reverse=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def received_awards(self):
|
||||||
|
|
||||||
|
awards = {}
|
||||||
|
|
||||||
|
posts_idlist = g.db.query(Submission.id).filter_by(author_id=self.id).subquery()
|
||||||
|
comments_idlist = g.db.query(Comment.id).filter_by(author_id=self.id).subquery()
|
||||||
|
|
||||||
|
post_awards = g.db.query(AwardRelationship).filter(AwardRelationship.submission_id.in_(posts_idlist)).all()
|
||||||
|
comment_awards = g.db.query(AwardRelationship).filter(AwardRelationship.comment_id.in_(comments_idlist)).all()
|
||||||
|
|
||||||
|
total_awards = post_awards + comment_awards
|
||||||
|
|
||||||
|
for a in total_awards:
|
||||||
|
if a.kind in awards:
|
||||||
|
awards[a.kind]['count'] += 1
|
||||||
|
else:
|
||||||
|
awards[a.kind] = a.type
|
||||||
|
awards[a.kind]['count'] = 1
|
||||||
|
|
||||||
|
return sorted(list(awards.values()), key=lambda x: x['kind'], reverse=True)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def post_notifications_count(self):
|
def post_notifications_count(self):
|
||||||
|
|
|
@ -4,9 +4,9 @@ from PIL import Image as IImage, ImageSequence
|
||||||
import base64
|
import base64
|
||||||
from files.classes.images import *
|
from files.classes.images import *
|
||||||
|
|
||||||
CF_KEY = environ.get("CLOUDFLARE_KEY").strip()
|
CF_KEY = environ.get("CLOUDFLARE_KEY", "").strip()
|
||||||
CF_ZONE = environ.get("CLOUDFLARE_ZONE").strip()
|
CF_ZONE = environ.get("CLOUDFLARE_ZONE", "").strip()
|
||||||
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
|
IMGUR_KEY = environ.get("IMGUR_KEY", "").strip()
|
||||||
|
|
||||||
|
|
||||||
def upload_file(file=None, resize=False, png=False):
|
def upload_file(file=None, resize=False, png=False):
|
||||||
|
|
|
@ -11,7 +11,7 @@ from files.__main__ import app
|
||||||
|
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
name = environ.get("SITE_NAME").strip()
|
name = environ.get("SITE_NAME").strip()
|
||||||
mailgun_domain = environ.get("MAILGUN_DOMAIN").strip()
|
mailgun_domain = environ.get("MAILGUN_DOMAIN", "").strip()
|
||||||
|
|
||||||
def send_mail(to_address, subject, html, plaintext=None, files={},
|
def send_mail(to_address, subject, html, plaintext=None, files={},
|
||||||
from_address=f"{name} <noreply@mail.{site}>"):
|
from_address=f"{name} <noreply@mail.{site}>"):
|
||||||
|
|
|
@ -13,7 +13,7 @@ valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")
|
||||||
valid_title_regex = re.compile("^((?!<).){3,100}$")
|
valid_title_regex = re.compile("^((?!<).){3,100}$")
|
||||||
valid_password_regex = re.compile("^.{8,100}$")
|
valid_password_regex = re.compile("^.{8,100}$")
|
||||||
|
|
||||||
YOUTUBE_KEY = environ.get("YOUTUBE_KEY").strip()
|
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
||||||
COINS_NAME = environ.get("COINS_NAME").strip()
|
COINS_NAME = environ.get("COINS_NAME").strip()
|
||||||
|
|
||||||
@app.post("/settings/profile")
|
@app.post("/settings/profile")
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
<div class="ml-3 w-100">
|
<div class="ml-3 w-100">
|
||||||
{% if u.is_suspended %}
|
{% if u.is_suspended %}
|
||||||
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
||||||
<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>
|
{% if u.unban_utc %}<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="d-flex align-items-center mt-1 mb-2">
|
<div class="d-flex align-items-center mt-1 mb-2">
|
||||||
|
@ -166,6 +166,18 @@
|
||||||
{% if u.bio_html and v %}
|
{% if u.bio_html and v %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if u.received_awards %}
|
||||||
|
<div class="text-white rounded p-2 mb-3" style="background-color: rgba(50, 50, 50, 0.6); width: 30%;">
|
||||||
|
<p class="text-uppercase my-0" style="font-weight: bold; font-size: 12px;">Awards received</p>
|
||||||
|
{% for a in u.received_awards %}
|
||||||
|
<span class="d-inline-block mx-1">
|
||||||
|
<i class="{{ a['icon'] }} {{ a['color'] }} fa-fw" data-toggle="tooltip" data-placement="bottom" title="{{ a['title'] }} Awards received"></i>
|
||||||
|
x{{ a['count'] }}
|
||||||
|
</span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<div>
|
<div>
|
||||||
{% if v and v.id != u.id %}
|
{% if v and v.id != u.id %}
|
||||||
|
@ -335,7 +347,7 @@
|
||||||
<div class="mt-n3 py-3">
|
<div class="mt-n3 py-3">
|
||||||
{% if u.is_suspended %}
|
{% if u.is_suspended %}
|
||||||
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
<h5 style="color:#ff66ac;">BANNED USER{% if u.ban_reason %}: {{u.ban_reason}}{% endif %}</h5>
|
||||||
<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>
|
{% if u.unban_utc %}<h5 style="color:#ff66ac;">{{u.unban_string}}</h5>{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="text-black"><h1 class="h5 d-inline-block" style="color: #{{u.namecolor}}">{{u.username}}</h1></a>
|
<a class="text-black"><h1 class="h5 d-inline-block" style="color: #{{u.namecolor}}">{{u.username}}</h1></a>
|
||||||
|
|
||||||
|
@ -363,6 +375,19 @@
|
||||||
{% if u.bio_html %}
|
{% if u.bio_html %}
|
||||||
<p class="text-muted text-break">{{u.bio_html | safe}}</p>
|
<p class="text-muted text-break">{{u.bio_html | safe}}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if u.received_awards %}
|
||||||
|
<div class="text-white rounded p-2 my-3 text-center" style="background-color: rgba(50, 50, 50, 0.6);">
|
||||||
|
<p class="text-uppercase my-0" style="font-weight: bold; font-size: 12px;">Awards received</p>
|
||||||
|
{% for a in u.received_awards %}
|
||||||
|
<span class="d-inline-block mx-1">
|
||||||
|
<i class="{{ a['icon'] }} {{ a['color'] }} fa-fw" data-toggle="tooltip" data-placement="bottom" title="{{ a['title'] }} Awards received"></i>
|
||||||
|
x{{ a['count'] }}
|
||||||
|
</span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
{% for b in u.badges %}
|
{% for b in u.badges %}
|
||||||
{% if b.url %}
|
{% if b.url %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue