Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

master
Aevann1 2022-08-31 16:57:26 +00:00
commit eace025042
7 changed files with 24 additions and 16 deletions

View File

@ -45,12 +45,15 @@ app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
if environ.get("MAIL_USERNAME2") and random.random() < 0.5:
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME2", "").strip()
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD2", "").strip()
else:
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
# if environ.get("MAIL_USERNAME2") and random.random() < 0.5:
# app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME2", "").strip()
# app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD2", "").strip()
# else:
# app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
# app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
app.config['SETTINGS'] = {}

View File

@ -90,9 +90,7 @@ class Comment(Base):
if not self.parent_submission: return True
if self.post.sub != 'chudrama': return True
if v:
if v.truecoins >= 5000: return True
if v.agendaposter: return True
if v.patron: return True
if v.can_see_chudrama: return True
if v.id == self.author_id: return True
if v.id == self.post.author_id: return True
return False

View File

@ -82,9 +82,7 @@ class Submission(Base):
if SITE != 'rdrama.net': return True
if self.sub != 'chudrama': return True
if v:
if v.truecoins >= 5000: return True
if v.agendaposter: return True
if v.patron: return True
if v.can_see_chudrama: return True
if v.id == self.author_id: return True
return False

View File

@ -822,4 +822,12 @@ class User(Base):
return 'Contributed at least $50'
if self.patron == 5:
return 'Contributed at least $100'
return ''
return ''
@property
@lazy
def can_see_chudrama(self):
if self.truecoins >= 5000: return True
if self.agendaposter: return True
if self.patron: return True
return False

View File

@ -92,7 +92,8 @@ reddit_domain_regex = re.compile("(^|\s|\()https?:\/\/(reddit\.com|new\.reddit.c
color_regex = re.compile("[a-z0-9]{6}", flags=re.A)
# lazy match on the {}?, only match if there is trailing stuff
showmore_regex = re.compile(r"^(.{3000,}?</p>)(\s*\S.*)", flags=re.A|re.DOTALL)
# don't match between nested </p></li> etc, this can break but works for Snappy
showmore_regex = re.compile(r"^(.{3000,}?</p>)(\s*<[^/].*)", flags=re.A|re.DOTALL)
search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A)

View File

@ -300,7 +300,7 @@ def comment(v):
body_html = sanitize(body_for_sanitize, limit_pings=5)
if parent_post.id not in ADMIGGERS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower() and parent_post.sub != 'chudrama':
if parent_post.id not in ADMIGGERS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.deleted_utc == 0,
Comment.parent_comment_id == parent_comment_id,

View File

@ -29,7 +29,7 @@ def front_all(v, sub=None, subdomain=None):
if sub:
sub = sub.strip().lower()
if sub == 'chudrama' and not (v and v.truecoins >= 5000): abort(403)
if sub == 'chudrama' and not (v and v.can_see_chudrama): abort(403)
sub = g.db.query(Sub).filter_by(name=sub).one_or_none()
if (request.path.startswith('/h/') or request.path.startswith('/s/')) and not sub: abort(404)