remotes/1693045480750635534/spooky-22
Aevann1 2021-07-27 23:58:35 +02:00
parent 60df8ae429
commit 56ee5fb9a7
3 changed files with 16 additions and 24 deletions

View File

@ -169,11 +169,9 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
@lazy
def domain(self):
if not self.url:
return "text post"
if not self.url: return "text post"
domain = urlparse(self.url).netloc
if domain.startswith("www."):
domain = domain.split("www.")[1]
if domain.startswith("www."): domain = domain.split("www.")[1]
return domain.replace("old.reddit.com", "reddit.com")
def tree_comments(self, comment=None, v=None):
@ -209,8 +207,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
def thumb_url(self):
if self.over_18: return f"/assets/images/nsfw.png"
elif self.thumburl: return self.thumburl
else: return None
return self.thumburl
@property
@ -410,7 +407,7 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
@property
def is_image(self):
if self.url: return self.url.lower().endswith('jpg') or self.url.lower().endswith('png') or self.url.lower().endswith('.gif') or self.url.lower().endswith('jpeg') or self.ur.lower().endswith('?maxwidth=9999') or self.url.lower().endswith('?maxwidth=8888')
if self.url: return self.url.lower().endswith('.jpg') or self.url.lower().endswith('.png') or self.url.lower().endswith('.gif') or self.url.lower().endswith('.jpeg') or self.url.lower().endswith('?maxwidth=9999') or self.url.lower().endswith('?maxwidth=8888')
else: return False
@property

View File

@ -275,17 +275,12 @@ def sign_up_post(v):
return new_signup("Passwords did not match. Please try again.")
# check username/pass conditions
if not re.match(valid_username_regex, username):
#print(f"signup fail - {username } - mismatched passwords")
if not re.fullmatch(valid_username_regex, username):
return new_signup("Invalid username")
if not re.match(valid_password_regex, request.form.get("password")):
#print(f"signup fail - {username } - invalid password")
if not re.fullmatch(valid_password_regex, request.form.get("password")):
return new_signup("Password must be between 8 and 100 characters.")
# if not re.match(valid_email_regex, request.form.get("email")):
# return new_signup("That's not a valid email.")
# Check for existing accounts
email = request.form.get("email")
email = email.strip()

View File

@ -63,27 +63,27 @@
<div class="card-header bg-transparent border-0 d-flex flex-row flex-nowrap pl-2 pl-md-0 p-0 mr-md-2">
<div class="position-relative d-none d-md-block" style="z-index: 3;">
{% if p.thumb_url and p.is_image %}
{% if not p.realurl(v) %}
<a href="{{p.permalink}}" {% if v and v.newtab %}target="_blank"{% endif %} rel="{% if p.author.is_private %}nofollow {% endif %}noopener">
<img src="/assets/images/default_thumb_text.png" class="post-img border-0" alt="text post thumbnail">
</a>
{% elif p.is_image %}
<a href="javascript:void(0)" rel="nofollow noopener" class="expandable-image" data-toggle="modal" data-target="#expandImageModal" data-url="{{p.realurl(v)}}">
<img src="{{p.thumb_url}}" class="post-img">
</a>
{% elif p.thumb_url and not p.embed_url %}
{% elif p.thumb_url %}
<a target="_blank" href="{{p.realurl(v)}}" rel="nofollow noopener" target="_blank">
<img src="{{p.thumb_url}}" class="post-img" alt="">
</a>
{% elif p.embed_url %}
{% elif "youtu.be" in p.domain or "youtube.com" in p.domain %}
<a target="_blank" href="{{p.realurl(v)}}" target="_blank" rel="nofollow noopener">
<img src="{{p.thumb_url if p.has_thumb else '/assets/images/default_thumb_yt.png'}}" class="post-img border-0" alt="generic youtube embed thumbnail">
<img src="{{p.thumb_url if p.thumb_url else '/assets/images/default_thumb_yt.png'}}" class="post-img border-0" alt="generic youtube embed thumbnail">
</a>
{% elif not p.realurl(v) %}
<a href="{{p.permalink}}" {% if v and v.newtab %}target="_blank"{% endif %} rel="{% if p.author.is_private %}nofollow {% endif %}noopener">
<img src="/assets/images/default_thumb_text.png" class="post-img border-0" alt="text post thumbnail">
</a>
{% elif p.realurl(v) and not p.thumb_url and not p.embed_url %}
{% else %}
<a target="_blank" href="{{p.realurl(v)}}" rel="nofollow noopener" target="_blank">
<img src="/assets/images/default_thumb_link.png" class="post-img border-0" alt="generic link post thumbnail">
</a>