diff --git a/compilecss.py b/compilecss.py deleted file mode 100644 index 923a70f22..000000000 --- a/compilecss.py +++ /dev/null @@ -1,7 +0,0 @@ -for theme in ['transparent', 'win98', 'midnight', 'dark', 'light', 'coffee', 'tron', '4chan']: - with open(f"./files/assets/css/{theme}_ff66ac.css", encoding='utf-8') as t: - text = t.read() - for color in ['ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','62ca56','eb4963','ff0000','f39731','30409f','3e98a7','e4432d','7b9ae4','ec72de','7f8fa6', 'f8db58']: - newtext = text.replace("ff66ac", color).replace("ff4097", color).replace("ff1a83", color).replace("ff3390", color).replace("rgba(255, 102, 172, 0.25)", color) - with open(f"./files/assets/css/{theme}_{color}.css", encoding='utf-8', mode='w') as nt: - nt.write(newtext) \ No newline at end of file diff --git a/files/__main__.py b/files/__main__.py index cce320c6e..57025e296 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -40,7 +40,7 @@ app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 * 365 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", "light").strip() + "_" + 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["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() diff --git a/files/classes/user.py b/files/classes/user.py index 9b2c17e02..db6479ad7 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -18,7 +18,7 @@ import random site = environ.get("DOMAIN").strip() site_name = environ.get("SITE_NAME").strip() -defaulttheme = environ.get("DEFAULT_THEME", "light").strip() +defaulttheme = environ.get("DEFAULT_THEME", "midnight").strip() defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip() defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip() cardview = bool(int(environ.get("CARD_VIEW", 1))) @@ -429,7 +429,7 @@ class User(Base): @lazy def profile_url(self): if self.profileurl: return self.profileurl - elif "rdrama" in site: return f"https://{site}/assets/images/defaultpictures/{random.randint(1, 150)}.webp" + elif "rama" in site: return f"https://{site}/assets/images/defaultpictures/{random.randint(1, 150)}.webp" else: return f"https://{site}/assets/images/default-profile-pic.webp" @property diff --git a/files/classes/userblock.py b/files/classes/userblock.py index b9be3092f..9a3ab1d70 100644 --- a/files/classes/userblock.py +++ b/files/classes/userblock.py @@ -1,8 +1,6 @@ from sqlalchemy import * from sqlalchemy.orm import relationship from files.__main__ import Base -from files.helpers.lazy import lazy -import time class UserBlock(Base): @@ -15,10 +13,4 @@ class UserBlock(Base): target = relationship("User", primaryjoin="User.id==UserBlock.target_id", viewonly=True) def __repr__(self): - - return f"" - - @property - @lazy - def created_date(self): - return time.strftime("%d %b %Y", time.gmtime(self.created_utc)) \ No newline at end of file + return f"" \ No newline at end of file diff --git a/files/routes/admin.py b/files/routes/admin.py index 6bb8d5a57..cb3118e40 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -31,7 +31,7 @@ def truescore(v): @limiter.limit("1/second") @admin_level_required(6) def revert_actions(v, username): - if 'pcm' in request.host or ('rdrama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rdrama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) @@ -116,7 +116,7 @@ def club_ban(v, username): @limiter.limit("1/second") @admin_level_required(6) def make_admin(v, username): - if 'pcm' in request.host or ('rdrama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rdrama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 6 @@ -129,7 +129,7 @@ def make_admin(v, username): @limiter.limit("1/second") @admin_level_required(6) def remove_admin(v, username): - if 'pcm' in request.host or ('rdrama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rdrama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 0 @@ -142,7 +142,7 @@ def remove_admin(v, username): @limiter.limit("1/second") @admin_level_required(6) def make_fake_admin(v, username): - if 'pcm' in request.host or ('rdrama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rdrama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 1 @@ -155,7 +155,7 @@ def make_fake_admin(v, username): @limiter.limit("1/second") @admin_level_required(6) def remove_fake_admin(v, username): - if 'pcm' in request.host or ('rdrama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rdrama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 0 @@ -168,7 +168,7 @@ def remove_fake_admin(v, username): @limiter.limit("1/day") @admin_level_required(6) def monthly(v): - if 'pcm' in request.host or ('rdrama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rdrama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or ('rama' in request.host and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id for u in g.db.query(User).options(lazyload('*')).filter(User.patron > 0).all(): grant_awards = {} diff --git a/files/routes/comments.py b/files/routes/comments.py index b36b90478..97529c2b7 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -42,7 +42,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): if not pid: if comment.parent_submission: pid = comment.parent_submission - elif "rdrama" in request.host: pid = 6489 + elif "rama" in request.host: pid = 6489 elif 'pcmemes.net' in request.host: pid = 382 else: pid = 1 @@ -148,7 +148,7 @@ def api_comment(v): if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400 - for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): + for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body) @@ -307,7 +307,7 @@ def api_comment(v): g.db.add(n) - if "rdrama" in request.host and "ivermectin" in c.body.lower(): + if "rama" in request.host and "ivermectin" in c.body.lower(): c.is_banned = True c.ban_reason = "ToS Violation" @@ -384,7 +384,7 @@ def api_comment(v): c.upvotes += 1 g.db.add(c) - if "rdrama" in request.host and len(body) >= 1000 and v.username != "Snappy" and "" not in body_html: + if "rama" in request.host and len(body) >= 1000 and v.username != "Snappy" and "" not in body_html: body = random.choice(LONGPOST_REPLIES) body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body) @@ -416,7 +416,7 @@ def api_comment(v): - if "rdrama" in request.host and random.random() < 0.001 and v.username != "Snappy" and v.username != "zozbot": + if "rama" in request.host and random.random() < 0.001 and v.username != "Snappy" and v.username != "zozbot": body = "zoz" body_md = CustomRenderer().render(mistletoe.Document(body)) @@ -579,7 +579,7 @@ def edit_comment(cid, v): if c.is_banned or c.deleted_utc > 0: abort(403) body = request.values.get("body", "")[:10000] - for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): + for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) @@ -657,7 +657,7 @@ def edit_comment(cid, v): c.body = body[:10000] c.body_html = body_html - if "rdrama" in request.host and "ivermectin" in c.body_html.lower(): + if "rama" in request.host and "ivermectin" in c.body_html.lower(): c.is_banned = True c.ban_reason = "ToS Violation" diff --git a/files/routes/discord.py b/files/routes/discord.py index a70f255d9..eea2f57e2 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -18,7 +18,7 @@ def join_discord(v): if v.is_suspended != 0: return "You're banned" - if 'rdrama' in request.host and v.admin_level == 0 and v.patron == 0 and v.truecoins < 150: return f"You must earn 150 {COINS_NAME} before entering the Discord server. You earn {COINS_NAME} by making posts/comments and getting upvoted." + if 'rama' in request.host and v.admin_level == 0 and v.patron == 0 and v.truecoins < 150: return f"You must earn 150 {COINS_NAME} before entering the Discord server. You earn {COINS_NAME} by making posts/comments and getting upvoted." if v.shadowbanned or v.agendaposter: return "" diff --git a/files/routes/front.py b/files/routes/front.py index e5ec38601..6650a6799 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -154,7 +154,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words=' posts = g.db.query(Submission.id).options(lazyload('*')) - if 'rdrama' in request.host and sort == "hot": + if 'rama' in request.host and sort == "hot": cutoff = int(time.time()) - 86400 posts = posts.filter(Submission.created_utc >= cutoff) elif t != 'all': diff --git a/files/routes/login.py b/files/routes/login.py index 1bcd8ae2e..60e5606e5 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -348,7 +348,7 @@ def sign_up_post(v): if email: send_verification_email(new_user) - if "rdrama" in request.host: send_notification(NOTIFICATIONS_ACCOUNT, new_user, "Dude bussy lmao") + if "rama" in request.host: send_notification(NOTIFICATIONS_ACCOUNT, new_user, "Dude bussy lmao") session["user_id"] = new_user.id session["session_id"] = token_hex(16) diff --git a/files/routes/posts.py b/files/routes/posts.py index 03817affc..980cacf37 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -206,7 +206,7 @@ def edit_post(pid, v): p.title_html = filter_title(title) if body != p.body: - for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): + for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') body_md = CustomRenderer().render(mistletoe.Document(body)) body_html = sanitize(body_md) @@ -227,7 +227,7 @@ def edit_post(pid, v): p.body = body p.body_html = body_html - if "rdrama" in request.host and "ivermectin" in body_html.lower(): + if "rama" in request.host and "ivermectin" in body_html.lower(): p.is_banned = True p.ban_reason = "ToS Violation" @@ -655,7 +655,7 @@ def submit_post(v): if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400 else: return render_template("submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400 - for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): + for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') body = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', body) @@ -785,7 +785,7 @@ def submit_post(v): g.db.flush() - if "rdrama" in request.host and "ivermectin" in new_post.body_html.lower(): + if "rama" in request.host and "ivermectin" in new_post.body_html.lower(): new_post.is_banned = True new_post.ban_reason = "ToS Violation" @@ -855,11 +855,11 @@ def submit_post(v): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) - if "rdrama" in request.host or (new_post.url and not "weebzone" in request.host and not "marsey.tech" in request.host): + if "rama" in request.host or (new_post.url and not "weebzone" in request.host and not "marsey.tech" in request.host): new_post.comment_count = 1 g.db.add(new_post) - if "rdrama" in request.host: + if "rama" in request.host: if v.id == 995: if random.random() < 0.02: body = "i love you carp" else: body = "fuck off carp" diff --git a/files/routes/settings.py b/files/routes/settings.py index 8eb5ccac6..2fb6466af 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -103,7 +103,7 @@ def settings_profile_post(v): if request.values.get("bio"): bio = request.values.get("bio")[:1500] - for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE): + for i in re.finditer('(^| )(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', bio, re.MULTILINE): if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'![]({i.group(1)})') bio = re.sub('([^\n])\n([^\n])', r'\1\n\n\2', bio) @@ -199,9 +199,7 @@ def settings_profile_post(v): theme = request.values.get("theme") if theme: v.theme = theme - if theme == "coffee" or theme == "4chan": v.themecolor = "38a169" - elif theme == "tron": v.themecolor = "80ffff" - elif theme == "win98": v.themecolor = "30409f" + if theme == "win98": v.themecolor = "30409f" updated = True quadrant = request.values.get("quadrant") @@ -291,7 +289,7 @@ def themecolor(v): @auth_required @validate_formkey def gumroad(v): - if 'rdrama' in request.host: patron = 'Paypig' + if 'rama' in request.host: patron = 'Paypig' else: patron = 'Patron' if not (v.email and v.is_activated): return {"error": f"You must have a verified email to verify {patron} status and claim your rewards"}, 400 diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 35b039936..049cf03a5 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -13,11 +13,13 @@ - {% if v %} - - {% if v.agendaposter %}{% endif %} + {% if v %} + + + {% if v.agendaposter %}{% endif %} {% else %} - + + {% endif %} diff --git a/files/templates/comments.html b/files/templates/comments.html index 7675af92f..1dd2f1f7b 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -235,7 +235,7 @@ {% if c.author.verified %} {% endif %} - {{c.author.username}} + {{c.author.username}} {% if c.author.customtitle %}  {% if c.author.quadrant %}{% endif %}{{c.author.customtitle | safe}}{% endif %} {% if c.parent_comment_id and not standalone and level<=7 %}{{ c.parent_comment.author.username }}{% endif %} @@ -370,7 +370,7 @@ {% endif %} Context - Copy link + Copy link {% if v %} Report {% endif %} @@ -525,7 +525,7 @@ Unsave {% endif %} - Copy link + Copy link Context diff --git a/files/templates/default.html b/files/templates/default.html index 2f7a84434..dfbfe56d1 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -249,25 +249,28 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% endif %} + + + + {% if v.agendaposter %}{% endif %} {% else %} - + + {% endif %} {% endblock %} - + {% block fixedMobileBarJS %} {% endblock %} - + {% if "marsey.tech" not in request.host and '@' not in request.path %} - - + + {% endif %} diff --git a/files/templates/delete_post_modal.html b/files/templates/delete_post_modal.html index 5b355c79f..7ae94dc73 100644 --- a/files/templates/delete_post_modal.html +++ b/files/templates/delete_post_modal.html @@ -36,10 +36,6 @@
- - - -
Delete post?
diff --git a/files/templates/email/default.html b/files/templates/email/default.html index f5396d90a..476d4faa6 100644 --- a/files/templates/email/default.html +++ b/files/templates/email/default.html @@ -366,13 +366,6 @@ } } - {% block preheader %}Thanks for joining {{'SITE_NAME' | app_config}}! Please take a sec to verify the email you used to sign up.{% endblock %} diff --git a/files/templates/errors/patron.html b/files/templates/errors/patron.html index 2fa38c45f..5b432d231 100644 --- a/files/templates/errors/patron.html +++ b/files/templates/errors/patron.html @@ -12,7 +12,7 @@

401 Not Authorized

-

This page is only available to {% if "rdrama" in request.host %}paypigs{% else %}patrons{% endif %}:

+

This page is only available to {% if "rama" in request.host %}paypigs{% else %}patrons{% endif %}:

{{'GUMROAD_LINK' | app_config}}
diff --git a/files/templates/header.html b/files/templates/header.html index 08914369e..bfb1dfe9f 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -1,7 +1,7 @@