forked from rDrama/rDrama
Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost
commit
eace025042
|
@ -45,10 +45,13 @@ app.config['MAIL_SERVER'] = 'smtp.gmail.com'
|
||||||
app.config['MAIL_PORT'] = 587
|
app.config['MAIL_PORT'] = 587
|
||||||
app.config['MAIL_USE_TLS'] = True
|
app.config['MAIL_USE_TLS'] = True
|
||||||
|
|
||||||
if environ.get("MAIL_USERNAME2") and random.random() < 0.5:
|
# if environ.get("MAIL_USERNAME2") and random.random() < 0.5:
|
||||||
app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME2", "").strip()
|
# app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME2", "").strip()
|
||||||
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD2", "").strip()
|
# app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD2", "").strip()
|
||||||
else:
|
# 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_USERNAME'] = environ.get("MAIL_USERNAME", "").strip()
|
||||||
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip()
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,7 @@ class Comment(Base):
|
||||||
if not self.parent_submission: return True
|
if not self.parent_submission: return True
|
||||||
if self.post.sub != 'chudrama': return True
|
if self.post.sub != 'chudrama': return True
|
||||||
if v:
|
if v:
|
||||||
if v.truecoins >= 5000: return True
|
if v.can_see_chudrama: return True
|
||||||
if v.agendaposter: return True
|
|
||||||
if v.patron: return True
|
|
||||||
if v.id == self.author_id: return True
|
if v.id == self.author_id: return True
|
||||||
if v.id == self.post.author_id: return True
|
if v.id == self.post.author_id: return True
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -82,9 +82,7 @@ class Submission(Base):
|
||||||
if SITE != 'rdrama.net': return True
|
if SITE != 'rdrama.net': return True
|
||||||
if self.sub != 'chudrama': return True
|
if self.sub != 'chudrama': return True
|
||||||
if v:
|
if v:
|
||||||
if v.truecoins >= 5000: return True
|
if v.can_see_chudrama: return True
|
||||||
if v.agendaposter: return True
|
|
||||||
if v.patron: return True
|
|
||||||
if v.id == self.author_id: return True
|
if v.id == self.author_id: return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -823,3 +823,11 @@ class User(Base):
|
||||||
if self.patron == 5:
|
if self.patron == 5:
|
||||||
return 'Contributed at least $100'
|
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
|
|
@ -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)
|
color_regex = re.compile("[a-z0-9]{6}", flags=re.A)
|
||||||
|
|
||||||
# lazy match on the {}?, only match if there is trailing stuff
|
# 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)
|
search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A)
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ def comment(v):
|
||||||
body_html = sanitize(body_for_sanitize, limit_pings=5)
|
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,
|
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.parent_comment_id == parent_comment_id,
|
Comment.parent_comment_id == parent_comment_id,
|
||||||
|
|
|
@ -29,7 +29,7 @@ def front_all(v, sub=None, subdomain=None):
|
||||||
|
|
||||||
if sub:
|
if sub:
|
||||||
sub = sub.strip().lower()
|
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()
|
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)
|
if (request.path.startswith('/h/') or request.path.startswith('/s/')) and not sub: abort(404)
|
||||||
|
|
Loading…
Reference in New Issue