diff --git a/drama/classes/submission.py b/drama/classes/submission.py index eebe4b297..7bab4d740 100644 --- a/drama/classes/submission.py +++ b/drama/classes/submission.py @@ -9,7 +9,7 @@ from .mix_ins import * from .flags import * from os import environ -domain = environ.get("domain").strip() +site = environ.get("domain").strip() class SubmissionAux(Base): @@ -199,11 +199,11 @@ class Submission(Base, Stndrd, Age_times, Scores, Fuzzing): @property @lazy def thumb_url(self): - if self.over_18: return f"https://{domain}/assets/images/nsfw.png" - elif not self.url: return f"https://{domain}/assets/images/default_thumb_text.png" + if self.over_18: return f"https://{site}/assets/images/nsfw.png" + elif not self.url: return f"https://{site}/assets/images/default_thumb_text.png" elif self.thumburl: return self.thumburl - elif "youtu.be" in self.domain or "youtube.com" in self.domain: return f"https://{domain}/assets/images/default_thumb_yt.png" - else: return f"https://{domain}/assets/images/default_thumb_link.png" + elif "youtu.be" in self.domain or "youtube.com" in self.domain: return f"https://{site}/assets/images/default_thumb_yt.png" + else: return f"https://{site}/assets/images/default_thumb_link.png" @property diff --git a/drama/classes/user.py b/drama/classes/user.py index 2bedff500..33d102c55 100644 --- a/drama/classes/user.py +++ b/drama/classes/user.py @@ -14,7 +14,7 @@ from .clients import * from drama.__main__ import Base, cache from drama.helpers.security import * -domain = environ.get("domain").strip() +site = environ.get("domain").strip() class User(Base, Stndrd, Age_times): __tablename__ = "users" @@ -443,12 +443,12 @@ class User(Base, Stndrd, Age_times): @property def banner_url(self): if self.bannerurl: return self.bannerurl - else: return f"https://{domain}/assets/images/default_bg.png" + else: return f"https://{site}/assets/images/default_bg.png" @cache.memoize(0) def defaultpicture(self): pic = random.randint(1, 50) - return f"https://{domain}/assets/images/defaultpictures/{pic}.png" + return f"https://{site}/assets/images/defaultpictures/{pic}.png" @property def profile_url(self): diff --git a/drama/mail/mail.py b/drama/mail/mail.py index 887262482..a5aaf3fce 100644 --- a/drama/mail/mail.py +++ b/drama/mail/mail.py @@ -9,7 +9,7 @@ from drama.helpers.wrappers import * from drama.classes import * from drama.__main__ import app -domain = environ.get("domain").strip() +site = environ.get("domain").strip() mailgun_domain = environ.get("MAILGUN_DOMAIN").strip() def send_mail(to_address, subject, html, plaintext=None, files={}, diff --git a/drama/routes/comments.py b/drama/routes/comments.py index e96c691d6..7ccc4e7fe 100644 --- a/drama/routes/comments.py +++ b/drama/routes/comments.py @@ -10,7 +10,7 @@ from pusher_push_notifications import PushNotifications from flask import * from drama.__main__ import app, limiter -domain = environ.get("domain").strip() +site = environ.get("domain").strip() choices = ['Wow, you must be a JP fan.', 'This is one of the worst posts I have EVER seen. Delete it.', "No, don't reply like this, please do another wall of unhinged rant please.", '# 😴😴😴', "Ma'am we've been over this before. You need to stop.", "I've known more coherent downies.", "Your pulitzer's in the mail", "That's great and all, but I asked for my burger without cheese.", 'That degree finally paying off', "That's nice sweaty. Why don't you have a seat in the time out corner with Pizzashill until you calm down, then you can have your Capri Sun.", "All them words won't bring your pa back.", "You had a chance to not be completely worthless, but it looks like you threw it away. At least you're consistent.", 'Some people are able to display their intelligence by going on at length on a subject and never actually saying anything. This ability is most common in trades such as politics, public relations, and law. You have impressed me by being able to best them all, while still coming off as an absolute idiot.', "You can type 10,000 characters and you decided that these were the one's that you wanted.", 'Have you owned the libs yet?', "I don't know what you said, because I've seen another human naked.", 'Impressive. Normally people with such severe developmental disabilities struggle to write much more than a sentence or two. He really has exceded our expectations for the writing portion. Sadly the coherency of his writing, along with his abilities in the social skills and reading portions, are far behind his peers with similar disabilities.', "This is a really long way of saying you don't fuck.", "Sorry ma'am, looks like his delusions have gotten worse. We'll have to admit him,", 'https://i.kym-cdn.com/photos/images/newsfeed/001/038/094/0a1.jpg', 'If only you could put that energy into your relationships', 'Posts like this is why I do Heroine.', 'still unemployed then?', 'K', 'look im gunna have 2 ask u 2 keep ur giant dumps in the toilet not in my replys 😷😷😷', "Mommy is soooo proud of you, sweaty. Let's put this sperg out up on the fridge with all your other failures.", "Good job bobby, here's a star", "That was a mistake. You're about to find out the hard way why.", 'You sat down and wrote all this shit. You could have done so many other things with your life. What happened to your life that made you decide writing novels of bullshit on reddit was the best option?', "I don't have enough spoons to read this shit", "All those words won't bring daddy back.", 'OUT!', "Mommy is soooo proud of you, sweaty. Let's put this sperg out up on the fridge with all your other failures."] @@ -529,7 +529,7 @@ def api_comment(v): 'notification': { 'title': f'New reply by @{v.username}', 'body': c.body, - 'deep_link': f'https://{domain}{c.permalink}?context=5#context', + 'deep_link': f'https://{site}{c.permalink}?context=5#context', }, }, }, diff --git a/drama/routes/feeds.py b/drama/routes/feeds.py index 033edcb56..91582b42b 100644 --- a/drama/routes/feeds.py +++ b/drama/routes/feeds.py @@ -54,7 +54,7 @@ def feeds_user(sort='hot', t='all'): with tag("name"): text(post.author.username) with tag("uri"): - text(f'https://{domain}/@{post.author.username}') + text(f'https://{site}/@{post.author.username}') doc.stag("link", href=full_link(post.permalink)) diff --git a/drama/routes/posts.py b/drama/routes/posts.py index b3b88ab4c..2511fb709 100644 --- a/drama/routes/posts.py +++ b/drama/routes/posts.py @@ -18,7 +18,7 @@ from drama.__main__ import app, limiter, cache from PIL import Image as PILimage from .front import frontlist -domain = environ.get("domain").strip() +site = environ.get("domain").strip() with open("snappy.txt", "r") as f: snappyquotes = f.read().split("{[para]}") @@ -334,7 +334,7 @@ def edit_post(pid, v): user = g.db.query(User).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user) - for x in notify_users: send_notification(1046, x, f"@{v.username} has mentioned you: https://{domain}{p.permalink}") + for x in notify_users: send_notification(1046, x, f"@{v.username} has mentioned you: https://{site}{p.permalink}") return redirect(p.permalink) @@ -847,12 +847,12 @@ def submit_post(v): user = g.db.query(User).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user) - for x in notify_users: send_notification(1046, x, f"@{v.username} has mentioned you: https://{domain}{new_post.permalink}") + for x in notify_users: send_notification(1046, x, f"@{v.username} has mentioned you: https://{site}{new_post.permalink}") if not new_post.private: for follow in v.followers: user = get_account(follow.user_id) - send_notification(2360, user, f"@{v.username} has made a new post: [{title}](https://{domain}{new_post.permalink})") + send_notification(2360, user, f"@{v.username} has made a new post: [{title}](https://{site}{new_post.permalink})") g.db.add(new_post) g.db.commit() @@ -927,7 +927,7 @@ def submit_post(v): n = Notification(comment_id=c.id, user_id=v.id) g.db.add(n) g.db.commit() - send_message(f"https://{domain}{new_post.permalink}") + send_message(f"https://{site}{new_post.permalink}") v.post_count = v.submissions.filter_by(is_banned=False, deleted_utc=0).count() g.db.add(v) diff --git a/drama/routes/static.py b/drama/routes/static.py index d40e05de2..f84aec5ae 100644 --- a/drama/routes/static.py +++ b/drama/routes/static.py @@ -2,7 +2,7 @@ from drama.mail import * from drama.__main__ import app, limiter from drama.helpers.alerts import * -domain = environ.get("domain").strip() +site = environ.get("domain").strip() @app.get("/patrons") @auth_desired @@ -78,7 +78,7 @@ def contact(v): @app.post("/contact") @auth_desired def submit_contact(v): - message = f'This message has been sent automatically to all admins via https://{domain}/contact, user email is "{v.email}"\n\nMessage:\n\n' + request.form.get("message", "") + message = f'This message has been sent automatically to all admins via https://{site}/contact, user email is "{v.email}"\n\nMessage:\n\n' + request.form.get("message", "") send_admin(v.id, message) return render_template("contact.html", v=v, msg="Your message has been sent.") diff --git a/drama/routes/users.py b/drama/routes/users.py index 9d465ce89..9bcc01e2e 100644 --- a/drama/routes/users.py +++ b/drama/routes/users.py @@ -12,7 +12,7 @@ from flask import * from drama.__main__ import app, limiter from pusher_push_notifications import PushNotifications -domain = environ.get("domain").strip() +site = environ.get("domain").strip() PUSHER_KEY = environ.get("PUSHER_KEY", "").strip() @@ -150,7 +150,7 @@ def message2(v, username): 'notification': { 'title': f'New message from @{v.username}', 'body': message, - 'deep_link': f'https://{domain}/notifications', + 'deep_link': f'https://{site}/notifications', }, }, },