dfdfdf
This commit is contained in:
parent
5adf35178a
commit
5751741622
8 changed files with 9 additions and 29 deletions
|
@ -17,10 +17,7 @@ class Domain(Base):
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
domain = Column(String)
|
domain = Column(String)
|
||||||
can_submit = Column(Boolean, default=True)
|
can_submit = Column(Boolean, default=True)
|
||||||
can_comment = Column(Boolean, default=True)
|
|
||||||
reason = Column(Integer, default=0)
|
reason = Column(Integer, default=0)
|
||||||
embed_function = Column(String(64))
|
|
||||||
embed_template = Column(String(32))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def reason_text(self):
|
def reason_text(self):
|
||||||
|
|
|
@ -406,9 +406,6 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||||
#def award_count(self):
|
#def award_count(self):
|
||||||
#return len(self.awards)
|
#return len(self.awards)
|
||||||
|
|
||||||
@property
|
|
||||||
def embed_template(self): return f"site_embeds/{self.domain_obj.embed_template}.html"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_image(self):
|
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')
|
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')
|
||||||
|
|
|
@ -31,7 +31,7 @@ def filter_comment_html(html_text):
|
||||||
# search db for domain rules that prohibit commenting
|
# search db for domain rules that prohibit commenting
|
||||||
bans = [
|
bans = [
|
||||||
x for x in g.db.query(Domain).filter_by(
|
x for x in g.db.query(Domain).filter_by(
|
||||||
can_comment=False).filter(
|
can_submit=False).filter(
|
||||||
Domain.domain.in_(
|
Domain.domain.in_(
|
||||||
list(domain_list))).all()]
|
list(domain_list))).all()]
|
||||||
|
|
||||||
|
|
|
@ -978,16 +978,12 @@ def admin_ban_domain(v):
|
||||||
d=g.db.query(Domain).filter_by(domain=d_query).first()
|
d=g.db.query(Domain).filter_by(domain=d_query).first()
|
||||||
if d:
|
if d:
|
||||||
d.can_submit=False
|
d.can_submit=False
|
||||||
d.can_comment=False
|
|
||||||
d.reason=reason
|
d.reason=reason
|
||||||
else:
|
else:
|
||||||
d=Domain(
|
d=Domain(
|
||||||
domain=domain,
|
domain=domain,
|
||||||
can_submit=False,
|
can_submit=False,
|
||||||
can_comment=False,
|
|
||||||
reason=reason,
|
reason=reason,
|
||||||
embed_function=None,
|
|
||||||
embed_template=None
|
|
||||||
)
|
)
|
||||||
|
|
||||||
g.db.add(d)
|
g.db.add(d)
|
||||||
|
|
|
@ -17,18 +17,9 @@
|
||||||
<h3 class="h5 pt-2">can_submit</h3>
|
<h3 class="h5 pt-2">can_submit</h3>
|
||||||
<p>{{domain.can_submit}}</p>
|
<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>
|
<h3 class="h5 pt-2">reason</h3>
|
||||||
<p>{{domain.reason_text}}</p>
|
<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>
|
<h2>Actions</h2>
|
||||||
|
|
||||||
<form action="/admin/ban_domain" method="post">
|
<form action="/admin/ban_domain" method="post">
|
||||||
|
|
|
@ -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>
|
|
|
@ -267,12 +267,14 @@
|
||||||
|
|
||||||
{{p.realbody(v) | safe}}
|
{{p.realbody(v) | safe}}
|
||||||
|
|
||||||
{% if p.embed_url and p.domain_obj and p.domain_obj.embed_template %}
|
{% if p.domain == "twitter.com" and (v and v.theme.split("_")[0] in ["light", "coffee", "4chan"]%}
|
||||||
{% if p.domain == "twitter.com" and session.get("light_mode_enabled") %}
|
{% include "site_embeds/twitterlight.html" %}
|
||||||
{% include "site_embeds/twitterdark.html" %}
|
{% elif "twitter.com" in p.domain %}
|
||||||
{% else %}
|
{% include "site_embeds/twitter.html" %}
|
||||||
{% include p.embed_template %}
|
{% elif "youtu" in p.domain %}
|
||||||
{% endif %}
|
{% include "site_embeds/youtube.html" %}
|
||||||
|
{% elif "instagram.com" in p.domain %}
|
||||||
|
{% include "site_embeds/instagram.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue