forked from rDrama/rDrama
1
0
Fork 0
rDrama/drama/classes/domains.py

46 lines
1018 B
Python
Raw Normal View History

2021-07-21 01:12:26 +00:00
from sqlalchemy import *
2021-07-22 19:19:49 +00:00
from drama.__main__ import Base
2021-07-21 01:12:26 +00:00
reasons = {
1: "URL shorteners are not allowed.",
3: "Piracy is not allowed.",
4: "Sites hosting digitally malicious content are not allowed.",
5: "Spam",
6: "Doxxing is not allowed.",
7: "Sexualizing minors is strictly prohibited."
}
class Domain(Base):
__tablename__ = "domains"
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)
2021-07-25 23:49:53 +00:00
embed_function = Column(String(64))
embed_template = Column(String(32))
2021-07-21 01:12:26 +00:00
@property
def reason_text(self):
return reasons.get(self.reason)
@property
def permalink(self):
return f"/admin/domain/{self.domain}"
class BadLink(Base):
__tablename__ = "badlinks"
id = Column(Integer, primary_key=True)
reason = Column(Integer)
link = Column(String(512))
autoban = Column(Boolean, default=False)
@property
def reason_text(self):
return reasons.get(self.reason)