remotes/1693045480750635534/spooky-22
Aevann1 2021-08-01 06:05:38 +02:00
parent 1df68c2c25
commit 049489e359
8 changed files with 9 additions and 29 deletions

View File

@ -17,10 +17,7 @@ class Domain(Base):
id = Column(Integer, primary_key=True)
domain = Column(String)
can_submit = Column(Boolean, default=True)
can_comment = Column(Boolean, default=True)
reason = Column(Integer, default=0)
embed_function = Column(String(64))
embed_template = Column(String(32))
@property
def reason_text(self):

View File

@ -406,9 +406,6 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
#def award_count(self):
#return len(self.awards)
@property
def embed_template(self): return f"site_embeds/{self.domain_obj.embed_template}.html"
@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.url.lower().endswith('?maxwidth=9999') or self.url.lower().endswith('?maxwidth=8888')

View File

@ -31,7 +31,7 @@ def filter_comment_html(html_text):
# search db for domain rules that prohibit commenting
bans = [
x for x in g.db.query(Domain).filter_by(
can_comment=False).filter(
can_submit=False).filter(
Domain.domain.in_(
list(domain_list))).all()]

View File

@ -978,16 +978,12 @@ def admin_ban_domain(v):
d=g.db.query(Domain).filter_by(domain=d_query).first()
if d:
d.can_submit=False
d.can_comment=False
d.reason=reason
else:
d=Domain(
domain=domain,
can_submit=False,
can_comment=False,
reason=reason,
embed_function=None,
embed_template=None
)
g.db.add(d)

View File

@ -17,18 +17,9 @@
<h3 class="h5 pt-2">can_submit</h3>
<p>{{domain.can_submit}}</p>
<h3 class="h5 pt-2">can_comment</h3>
<p>{{domain.can_comment}}</p>
<h3 class="h5 pt-2">reason</h3>
<p>{{domain.reason_text}}</p>
<h3 class="h5 pt-2">embed_function</h3>
<p>{{domain.embed_function}}</p>
<h3 class="h5 pt-2">embed_template</h3>
<p>{{domain.embed_template}}</p>
<h2>Actions</h2>
<form action="/admin/ban_domain" method="post">

View File

@ -1,3 +0,0 @@
<div class="embed-responsive embed-responsive-16by9 mb-3">
<iframe src="{{p.embed_url}}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>

View File

@ -267,12 +267,14 @@
{{p.realbody(v) | safe}}
{% if p.embed_url and p.domain_obj and p.domain_obj.embed_template %}
{% if p.domain == "twitter.com" and session.get("light_mode_enabled") %}
{% include "site_embeds/twitterdark.html" %}
{% else %}
{% include p.embed_template %}
{% endif %}
{% if p.domain == "twitter.com" and (v and v.theme.split("_")[0] in ["light", "coffee", "4chan"]%}
{% include "site_embeds/twitterlight.html" %}
{% elif "twitter.com" in p.domain %}
{% include "site_embeds/twitter.html" %}
{% elif "youtu" in p.domain %}
{% include "site_embeds/youtube.html" %}
{% elif "instagram.com" in p.domain %}
{% include "site_embeds/instagram.html" %}
{% endif %}
</div>