diff --git a/env b/env index 27a5fb312..4d8b5c95f 100644 --- a/env +++ b/env @@ -2,8 +2,8 @@ export FLASK_APP="/rDrama/files/cli:app" export SITE="localhost" export SITE_NAME="rDrama" export SECRET_KEY="blahblahblah" -export DATABASE_URL="postgresql://postgres@localhost:5432" -export REDIS_URL="redis://localhost:6379" +export DATABASE_URL="postgresql://postgres@postgres:5432" +export REDIS_URL="redis://redis:6379" export PROXY_URL="http://localhost:18080" export LOG_DIRECTORY="/var/log/rdrama" export SETTINGS_FILENAME="/site_settings.json" diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 80702b306..254ebd957 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -3925,7 +3925,7 @@ ul.comment-section { border-left: none; top: -0.1px; left: -3px; - font-size: 10px; + font-size: 14px; } .comment.collapsed .comment-collapse-icon:hover::before { color: var(--primary); @@ -4774,7 +4774,7 @@ video { width: 10px; content: "\f056"; position: static; - font-size: 10px; + font-size: 14px; font-weight: 900; border: none; margin-left: 0.25rem; diff --git a/files/assets/css/midnight.css b/files/assets/css/midnight.css index 7bf953da5..86d17e0c8 100644 --- a/files/assets/css/midnight.css +++ b/files/assets/css/midnight.css @@ -66,5 +66,5 @@ h5.post-title a:visited { } .modal-content { - border: 3px var(--gray-500) solid; + border: 1px var(--gray-500) solid; } diff --git a/files/assets/css/transparent.css b/files/assets/css/transparent.css index c4ceb7c9b..a97d8ef43 100644 --- a/files/assets/css/transparent.css +++ b/files/assets/css/transparent.css @@ -16,6 +16,6 @@ background-color: #21262d !important; } -.App-side, .flaggers { +.App-side, .flaggers, .comment-section { background: transparent !important; } diff --git a/files/assets/images/PCM/app-chromium-lo-1.webp b/files/assets/images/PCM/app-chromium-lo-1.webp new file mode 100644 index 000000000..cbab3a0f9 Binary files /dev/null and b/files/assets/images/PCM/app-chromium-lo-1.webp differ diff --git a/files/assets/images/PCM/app-chromium-lo-2.webp b/files/assets/images/PCM/app-chromium-lo-2.webp new file mode 100644 index 000000000..8521b8e2c Binary files /dev/null and b/files/assets/images/PCM/app-chromium-lo-2.webp differ diff --git a/files/assets/images/PCM/banners_event/2022christmas1.webp b/files/assets/images/PCM/banners_event/2022christmas1.webp new file mode 100644 index 000000000..0e464b8ba Binary files /dev/null and b/files/assets/images/PCM/banners_event/2022christmas1.webp differ diff --git a/files/assets/images/WPD/app-chromium-lo-1.webp b/files/assets/images/WPD/app-chromium-lo-1.webp new file mode 100644 index 000000000..6ebd6ab91 Binary files /dev/null and b/files/assets/images/WPD/app-chromium-lo-1.webp differ diff --git a/files/assets/images/WPD/app-chromium-lo-2.webp b/files/assets/images/WPD/app-chromium-lo-2.webp new file mode 100644 index 000000000..0dfd768ea Binary files /dev/null and b/files/assets/images/WPD/app-chromium-lo-2.webp differ diff --git a/files/assets/images/rDrama/app-chromium-lo-1.webp b/files/assets/images/rDrama/app-chromium-lo-1.webp new file mode 100644 index 000000000..3b1d09db8 Binary files /dev/null and b/files/assets/images/rDrama/app-chromium-lo-1.webp differ diff --git a/files/assets/images/rDrama/app-chromium-lo-2.webp b/files/assets/images/rDrama/app-chromium-lo-2.webp new file mode 100644 index 000000000..48d77b380 Binary files /dev/null and b/files/assets/images/rDrama/app-chromium-lo-2.webp differ diff --git a/files/assets/images/rDrama/banner_error.webp b/files/assets/images/rDrama/banner_error.webp new file mode 100644 index 000000000..1a25c228f Binary files /dev/null and b/files/assets/images/rDrama/banner_error.webp differ diff --git a/files/assets/images/rDrama/sidebar/867.webp b/files/assets/images/rDrama/sidebar/867.webp new file mode 100644 index 000000000..4e45dc299 Binary files /dev/null and b/files/assets/images/rDrama/sidebar/867.webp differ diff --git a/files/assets/images/rDrama/sidebar/868.webp b/files/assets/images/rDrama/sidebar/868.webp new file mode 100644 index 000000000..8893f325c Binary files /dev/null and b/files/assets/images/rDrama/sidebar/868.webp differ diff --git a/files/assets/images/rDrama/sidebar/869.webp b/files/assets/images/rDrama/sidebar/869.webp new file mode 100644 index 000000000..edb708a39 Binary files /dev/null and b/files/assets/images/rDrama/sidebar/869.webp differ diff --git a/files/classes/user.py b/files/classes/user.py index db3b652d2..a52d693b4 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -1,12 +1,12 @@ import random from operator import * -from typing import Union +from typing import Any, Union import pyotp from sqlalchemy import Column, ForeignKey from sqlalchemy.orm import aliased, deferred from sqlalchemy.sql import func -from sqlalchemy.sql.expression import not_, and_, or_ +from sqlalchemy.sql.expression import not_, and_, or_, ColumnOperators from sqlalchemy.sql.sqltypes import * from files.classes import Base @@ -129,6 +129,7 @@ class User(Base): total_lottery_winnings = Column(Integer, default=0) last_viewed_post_notifs = Column(Integer, default=0) last_viewed_log_notifs = Column(Integer, default=0) + last_viewed_reddit_notifs = Column(Integer, default=0) pronouns = Column(String, default='they/them') bite = Column(Integer) earlylife = Column(Integer) @@ -413,6 +414,13 @@ class User(Base): def can_view_offsitementions(self): return self.offsitementions or self.admin_level >= PERMS['NOTIFICATIONS_REDDIT'] + @lazy + def can_edit(self, target:Union[Submission, Comment]) -> bool: + if isinstance(target, Comment) and not target.post: return False + if self.id == target.author_id: return True + if not isinstance(target, Submission): return False + return bool(self.admin_level >= PERMS['POST_EDITING']) + @property @lazy def user_awards(self): @@ -632,7 +640,7 @@ class User(Base): if not self.can_see_shadowbanned: notifs = notifs.filter(User.shadowbanned == None) - return notifs.count() + self.post_notifications_count + self.modaction_notifications_count + return notifs.count() + self.post_notifications_count + self.modaction_notifications_count + self.reddit_notifications_count @property @lazy @@ -701,9 +709,9 @@ class User(Base): @property @lazy def reddit_notifications_count(self): - if not self.can_view_offsitementions: return 0 - return g.db.query(Notification).join(Comment).filter( - Notification.user_id == self.id, Notification.read == False, + if not self.can_view_offsitementions or self.id == AEVANN_ID: return 0 + return g.db.query(Comment).filter( + Comment.created_utc > self.last_viewed_reddit_notifs, Comment.is_banned == False, Comment.deleted_utc == 0, Comment.body_html.like('%
New site mention%nigger! I think this error means that there's a nigger error. And I think that means something took too long to load so it decided to be a nigger. If you keep seeing this on the same page but not other pages, then something its probably a niggerfaggot. It may not be called a nigger, but that sounds right to me. Anyway, ping me and I'll whine to someone smarter to fix it. Don't bother them. Thanks ily <3"
ERROR_MARSEYS[500] = "wholesome"
POST_RATE_LIMIT = '1/second;4/minute;20/hour;100/day'
@@ -678,7 +686,7 @@ elif SITE == 'watchpeopledie.tv':
}
BADGE_WHITELIST = {
- 85, 99, 101, # Sigma, Artist Badges x2
+ 7, 74, 85, 99, 101, # Bug, Grass, Sigma, SidebarArt, BannerArt
59, 60, 66, 104, 108, # Classic Accolades, Nword
117, 124, 144, 145, 146, 147, 148, 149, # Census Reused for Fun
}
@@ -1729,6 +1737,7 @@ if SITE_NAME == 'rDrama':
'us.forums.blizzard.com',
'eu.forums.blizzard.com',
'bungie.net',
+ 'soyjak.party',
#fediverse
'rdrama.cc',
diff --git a/files/helpers/cron.py b/files/helpers/cron.py
index 687b9b316..b8b10207f 100644
--- a/files/helpers/cron.py
+++ b/files/helpers/cron.py
@@ -131,6 +131,7 @@ def _give_monthly_marseybux_task():
g.db.add(u)
if u.admin_level or u.id in GUMROAD_MESSY:
give_marseybux(u)
+ badge_grant(badge_id=20+u.patron, user=u, notify=False)
elif u.email and u.is_activated and u.email.lower() in emails:
data = {'access_token': GUMROAD_TOKEN, 'email': u.email}
try:
diff --git a/files/helpers/offsitementions.py b/files/helpers/offsitementions.py
index ca39ff80e..aca51924d 100644
--- a/files/helpers/offsitementions.py
+++ b/files/helpers/offsitementions.py
@@ -10,7 +10,6 @@ from sqlalchemy import or_
import files.helpers.const as const
from files.classes.badges import Badge
from files.classes.comment import Comment
-from files.classes.notifications import Notification
from files.classes.user import User
from files.helpers.sanitize import sanitize
@@ -21,23 +20,15 @@ from files.helpers.sanitize import sanitize
# value from /meta (or just guessing) and doing a random selection of keywords.
def offsite_mentions_task(cache:Cache):
- if const.REDDIT_NOTIFS_SITE:
- row_send_to = g.db.query(Badge.user_id).filter_by(badge_id=140).all()
- row_send_to += g.db.query(User.id).filter(
- User.admin_level >= const.PERMS['NOTIFICATIONS_REDDIT'],
- User.id != const.AEVANN_ID,
- ).all()
-
- send_to = [x[0] for x in row_send_to]
- send_to = set(send_to)
-
- site_mentions = get_mentions(cache, const.REDDIT_NOTIFS_SITE)
- notify_mentions(send_to, site_mentions)
+ site_mentions = get_mentions(cache, const.REDDIT_NOTIFS_SITE)
+ notify_mentions(site_mentions)
if const.REDDIT_NOTIFS_USERS:
for query, send_user in const.REDDIT_NOTIFS_USERS.items():
user_mentions = get_mentions(cache, [query], reddit_notifs_users=True)
- notify_mentions([send_user], user_mentions, mention_str='mention of you')
+ notify_mentions(user_mentions, send_to=send_user, mention_str='mention of you')
+
+ g.db.commit() # commit early otherwise localhost testing fails to commit
def get_mentions(cache:Cache, queries:Iterable[str], reddit_notifs_users=False):
kinds = ['submission', 'comment']
@@ -90,7 +81,7 @@ def get_mentions(cache:Cache, queries:Iterable[str], reddit_notifs_users=False):
print("Failed to set cache value; there may be duplication of reddit notifications")
return mentions
-def notify_mentions(send_to, mentions, mention_str='site mention'):
+def notify_mentions(mentions, send_to=None, mention_str='site mention'):
for m in mentions:
author = m['author']
permalink = m['permalink']
@@ -119,6 +110,6 @@ def notify_mentions(send_to, mentions, mention_str='site mention'):
g.db.flush()
new_comment.top_comment_id = new_comment.id
- for user_id in send_to:
- notif = Notification(comment_id=new_comment.id, user_id=user_id)
+ if send_to:
+ notif = Notification(comment_id=new_comment.id, user_id=send_to)
g.db.add(notif)
diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index 6a156e486..5fa797015 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -38,7 +38,7 @@ TLDS = ( # Original gTLDs and ccTLDs
# New gTLDs
'app','cleaning','club','dev','farm','florist','fun','gay','lgbt','life','lol',
'moe','mom','monster','new','news','online','pics','press','pub','site',
- 'vip','win','world','wtf','xyz','video','host','art',
+ 'vip','win','world','wtf','xyz','video','host','art','media'
)
allowed_tags = ('b','blockquote','br','code','del','em','h1','h2','h3','h4','h5','h6','hr','i',
diff --git a/files/routes/allroutes.py b/files/routes/allroutes.py
index 649f11493..59bb74738 100644
--- a/files/routes/allroutes.py
+++ b/files/routes/allroutes.py
@@ -32,13 +32,6 @@ def before_request():
g.webview = '; wv) ' in ua
- if ' firefox/' in ua:
- g.type = 'firefox'
- elif 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua:
- g.type = 'apple'
- else:
- g.type = 'chromium'
-
g.is_tor = request.headers.get("cf-ipcountry") == "T1"
request.path = request.path.rstrip('/')
diff --git a/files/routes/notifications.py b/files/routes/notifications.py
index 80be4d52c..c66adb425 100644
--- a/files/routes/notifications.py
+++ b/files/routes/notifications.py
@@ -224,28 +224,20 @@ def notifications_reddit(v:User):
if not v.can_view_offsitementions: abort(403)
- notifications = g.db.query(Notification, Comment).join(Notification.comment).filter(
- Notification.user_id == v.id,
+ listing = g.db.query(Comment).filter(
Comment.body_html.like('% New site mention%New site mention% 7*24*60*60 and not p.private
@@ -924,9 +923,11 @@ def submit_post(v:User, sub=None):
execute_lawlz_actions(v, post)
- if SITE == 'rdrama.net' and v.id in (IMPASSIONATA_ID, PIZZASHILL_ID, 2008):
+ if (SITE == 'rdrama.net'
+ and v.id in (IMPASSIONATA_ID, PIZZASHILL_ID, 2008)
+ and not (post.sub and post.sub.stealth)):
post.stickied_utc = int(time.time()) + 3600
- post.stickied = AUTOJANNY_ID
+ post.stickied = "AutoJanny"
cache.delete_memoized(frontlist)
cache.delete_memoized(userpagelisting)
@@ -941,7 +942,7 @@ def submit_post(v:User, sub=None):
if v.client: return post.json(g.db)
else:
post.voted = 1
- if post.new or 'megathread' in post.title.lower(): sort = 'new'
+ if post.new: sort = 'new'
else: sort = v.defaultsortingcomments
return render_template('submission.html', v=v, p=post, sort=sort, render_replies=True, offset=0, success=True, sub=post.subr)
@@ -1073,6 +1074,16 @@ def pin_post(post_id, v):
else: return {"message": "Post unpinned!"}
return abort(404, "Post not found!")
+@app.route("/post/
- Hiiiiii it’s your favorite user Carp! We’re currently on Login Required mode for one of a few reasons:
-
- But that’s all fine. Signing up is easy. It takes literally like 4 seconds if you’re slow. You don’t even need an email! Just pick a username, make up some neat new password where you replace all the e’s with 3s or whatever and bam, done, you’re in.
- I love you.
- Hi you! — watchpeopledie.tv is currently doing our monthly 24(ish) hours of "everyone needs to have an account" — sorry about that! But making an account is actually super easy. You don't even need an email address! Literally just pick a username, set a password, and that's that. Bam, done, like 8 seconds, tops.
- We WANT you with us 💖
-
-
- Remember to click “Follow” on my profile!
-
- xoxo carp 💋
-
- {% elif not ref_user and SITE_NAME == 'WPD' and site_settings['login_required'] %}
-
-
- Please join!
-
- {% endif %}
-