diff --git a/env b/env index 9960e3d82..2639f70b2 100755 --- a/env +++ b/env @@ -1,4 +1,4 @@ -export DATABASE_URL="postgresql://postgres@127.0.0.1:5432" +export DATABASE_URL="postgresql://postgres@0.0.0.0:5432" export MASTER_KEY="-KTVciAUQFpFh2WdJ/oiHJlxl6FvzRZp8kYzAAv3l2OA=" export DOMAIN="localhost" export SITE_NAME="Drama" diff --git a/files/__main__.py b/files/__main__.py index 95628b7db..28882d1c5 100755 --- a/files/__main__.py +++ b/files/__main__.py @@ -41,7 +41,7 @@ app.config["SESSION_REFRESH_EACH_REQUEST"] = True app.config["SLOGAN"] = environ.get("SLOGAN", "").strip() app.config["DEFAULT_COLOR"] = environ.get("DEFAULT_COLOR", "ff0000").strip() app.config["DEFAULT_THEME"] = environ.get("DEFAULT_THEME", "midnight").strip() -app.config["FORCE_HTTPS"] = int(environ.get("FORCE_HTTPS", 1)) if ("localhost" not in app.config["SERVER_NAME"] and "127.0.0.1" not in app.config["SERVER_NAME"]) else 0 +app.config["FORCE_HTTPS"] = int(environ.get("FORCE_HTTPS", 1)) if ("localhost" not in app.config["SERVER_NAME"] and "0.0.0.0" not in app.config["SERVER_NAME"]) else 0 app.config["UserAgent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36" app.config["HCAPTCHA_SITEKEY"] = environ.get("HCAPTCHA_SITEKEY","").strip() app.config["HCAPTCHA_SECRET"] = environ.get("HCAPTCHA_SECRET","").strip() @@ -60,14 +60,14 @@ app.config["RATELIMIT_DEFAULTS_EXEMPT_WHEN"]=lambda:False app.config["RATELIMIT_HEADERS_ENABLED"]=True app.config["CACHE_TYPE"] = "filesystem" app.config["CACHE_DIR"] = "cache" -app.config["RATELIMIT_STORAGE_URL"] = environ.get("REDIS_URL", "redis://127.0.0.1") +app.config["RATELIMIT_STORAGE_URL"] = environ.get("REDIS_URL", "redis://0.0.0.0") app.config['MAIL_SERVER'] = 'smtp.gmail.com' app.config['MAIL_PORT'] = 587 app.config['MAIL_USE_TLS'] = True app.config['MAIL_USERNAME'] = environ.get("MAIL_USERNAME", "").strip() app.config['MAIL_PASSWORD'] = environ.get("MAIL_PASSWORD", "").strip() -r=redis.Redis(host=environ.get("REDIS_URL", "redis://127.0.0.1"), decode_responses=True, ssl_cert_reqs=None) +r=redis.Redis(host=environ.get("REDIS_URL", "redis://0.0.0.0"), decode_responses=True, ssl_cert_reqs=None) limiter = Limiter( app, diff --git a/files/classes/submission.py b/files/classes/submission.py index c7aec92ad..d7905e304 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -9,7 +9,7 @@ from sqlalchemy import * from sqlalchemy.orm import relationship, deferred from files.__main__ import Base -from files.helpers.const import AUTOPOLLER_ACCOUNT, censor_slurs +from files.helpers.const import AUTOPOLLER_ACCOUNT, censor_slurs, TROLLTITLES from files.helpers.lazy import lazy from .flags import Flag @@ -331,7 +331,7 @@ class Submission(Base): @lazy def realtitle(self, v): if self.club and not (v and v.paid_dues) and not (v and v.admin_level == 6): - if v: return f'{v.username} dox' + if v: return random.choice(TROLLTITLES).format(username=v.username) else: return 'COUNTRY CLUB MEMBERS ONLY' elif self.title_html: title = self.title_html else: title = self.title @@ -343,7 +343,7 @@ class Submission(Base): @lazy def plaintitle(self, v): if self.club and not (v and v.paid_dues) and not (v and v.admin_level == 6): - if v: return f'{v.username} dox' + if v: return random.choice(TROLLTITLES).format(username=v.username) else: return 'COUNTRY CLUB MEMBERS ONLY' else: title = self.title diff --git a/files/helpers/const.py b/files/helpers/const.py index 0aece46c6..273333b64 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -302,4 +302,12 @@ else: "color": "text-success", "price": 40000 }, - } \ No newline at end of file + } + +TROLLTITLES = [ + "how will @{username} ever recover?", + "@{username} BTFO", + "[META] Getting really sick of @{username}’s shit", + "Pretty sure this is @{username}'s Reddit account", + "Hey jannies can you please ban @{username}", +] \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index 99744df88..18cb680c6 100755 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -500,13 +500,13 @@ def api_comment(v): if not v.shadowbanned: notify_users = set() - for x in g.db.query(Subscription.user_id).options(lazyload('*')).filter_by(submission_id=c.parent_submission).all(): - notify_users.add(x[0]) + for x in g.db.query(Subscription.user_id).options(lazyload('*')).filter_by(submission_id=c.parent_submission).all(): notify_users.add(x[0]) if parent.author.id != v.id: notify_users.add(parent.author.id) soup = BeautifulSoup(body_html, features="html.parser") mentions = soup.find_all("a", href=re.compile("^/@(\w+)")) + for mention in mentions: username = mention["href"].split("@")[1] @@ -517,6 +517,10 @@ def api_comment(v): continue if user.id != v.id: notify_users.add(user.id) + + if request.host == 'rdrama.net' and 'aevann' in body_html.lower() and 1 not in notify_users: + notify_users.append(1) + for x in notify_users: n = Notification(comment_id=c.id, user_id=x) g.db.add(n) @@ -745,6 +749,8 @@ def edit_comment(cid, v): if user.id != v.id: notify_users.add(user.id) + if request.host == 'rdrama.net' and 'aevann' in body_html.lower() and 1 not in notify_users: notify_users.append(1) + for x in notify_users: notif = notifs.filter_by(comment_id=c.id, user_id=x).first() if not notif: diff --git a/files/routes/posts.py b/files/routes/posts.py index a5f2926dc..381f291de 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -66,6 +66,8 @@ def publish(pid, v): user = g.db.query(User).options(lazyload('*')).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user) + if request.host == 'rdrama.net' and 'aevann' in post.body_html.lower() and 1 not in notify_users: notify_users.append(1) + for x in notify_users: send_notification(x.id, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}") for follow in v.followers: @@ -309,6 +311,9 @@ def edit_post(pid, v): if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user) message = f"@{v.username} has mentioned you: http://{site}{p.permalink}" + + if request.host == 'rdrama.net' and 'aevann' in body_html.lower() and 1 not in notify_users: notify_users.append(1) + for x in notify_users: existing = g.db.query(Comment).options(lazyload('*')).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message, Comment.notifiedto == x.id).first() if not existing: send_notification(x.id, message) @@ -742,7 +747,9 @@ def submit_post(v): username = mention["href"].split("@")[1] user = g.db.query(User).options(lazyload('*')).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user) - + + if request.host == 'rdrama.net' and 'aevann' in body_html.lower() and 1 not in notify_users: notify_users.append(1) + for x in notify_users: send_notification(x.id, f"@{v.username} has mentioned you: http://{site}{new_post.permalink}") for follow in v.followers: diff --git a/files/templates/comments.html b/files/templates/comments.html index 6a2acba16..96c2abeb0 100755 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -278,7 +278,7 @@ {% if c.is_blocking %}{% endif %} {% if c.is_blocked %}{% endif %} - {% if c.author.verified %} + {% if c.author.verified %} {% endif %} {{c.author.username}} diff --git a/files/templates/submission.html b/files/templates/submission.html index 40dacbf66..28b3ba208 100755 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -424,7 +424,7 @@ {% if p.over_18 %}+18{% endif %} {% if p.private %}Draft{% endif %} {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} - {% if p.author.verified %} + {% if p.author.verified %} {% endif %} {{p.author.username}}{% if p.author.customtitle %} {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %} {{p.age_string}} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 8950d82c3..eb785dbf7 100755 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -192,7 +192,7 @@ {% if p.is_blocked %}{% endif %} {% if p.private %}Draft{% endif %} {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} - {% if p.author.verified %} + {% if p.author.verified %} {% endif %} {{p.author.username}}{% if p.author.customtitle %} {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %} {{p.age_string}} diff --git a/files/templates/submit.html b/files/templates/submit.html index 101abf024..d449ef892 100755 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -71,7 +71,7 @@