diff --git a/drama/classes/domains.py b/drama/classes/domains.py index 694829773..0332b35c9 100644 --- a/drama/classes/domains.py +++ b/drama/classes/domains.py @@ -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): diff --git a/drama/classes/submission.py b/drama/classes/submission.py index a5ac38748..8ad4cb908 100644 --- a/drama/classes/submission.py +++ b/drama/classes/submission.py @@ -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') diff --git a/drama/helpers/filters.py b/drama/helpers/filters.py index bf24a3739..e67b21348 100644 --- a/drama/helpers/filters.py +++ b/drama/helpers/filters.py @@ -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()] diff --git a/drama/routes/admin.py b/drama/routes/admin.py index afd042771..7fca611e3 100644 --- a/drama/routes/admin.py +++ b/drama/routes/admin.py @@ -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) diff --git a/drama/templates/admin/manage_domain.html b/drama/templates/admin/manage_domain.html index 631986c0c..c74af121d 100644 --- a/drama/templates/admin/manage_domain.html +++ b/drama/templates/admin/manage_domain.html @@ -17,18 +17,9 @@

can_submit

{{domain.can_submit}}

-

can_comment

-

{{domain.can_comment}}

-

reason

{{domain.reason_text}}

-

embed_function

-

{{domain.embed_function}}

- -

embed_template

-

{{domain.embed_template}}

-

Actions

diff --git a/drama/templates/site_embeds/bitchute.html b/drama/templates/site_embeds/bitchute.html deleted file mode 100644 index 5f1fcfbc6..000000000 --- a/drama/templates/site_embeds/bitchute.html +++ /dev/null @@ -1,3 +0,0 @@ -
- -
\ No newline at end of file diff --git a/drama/templates/site_embeds/twitterdark.html b/drama/templates/site_embeds/twitterlight.html similarity index 100% rename from drama/templates/site_embeds/twitterdark.html rename to drama/templates/site_embeds/twitterlight.html diff --git a/drama/templates/submission.html b/drama/templates/submission.html index 55e30e0e1..688e080b0 100644 --- a/drama/templates/submission.html +++ b/drama/templates/submission.html @@ -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 %}