diff --git a/files/helpers/const.py b/files/helpers/const.py index 45fac0a70..2d6a43bc2 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -888,6 +888,8 @@ yt_id_regex = re.compile('[a-z0-9-_]{5,20}', flags=re.I|re.A) image_regex = re.compile("(^|\s)(https:\/\/[\w\-.#&/=\?@%;+]{5,250}(\.png|\.jpg|\.jpeg|\.gif|\.webp|maxwidth=9999|fidelity=high))($|\s)", flags=re.I|re.A) +link_fix_regex = re.compile("(?!.*(http|\/))(.*\[[^\]]+\]\()([^)]+\))", flags=re.A) + css_regex = re.compile('''url\(['"]?(.*?)['"]?\)''', flags=re.I|re.A) css_regex2 = re.compile('''['"](http.*?)['"]''', flags=re.I|re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index b999c301b..91c7982f9 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -137,6 +137,8 @@ def sanitize(sanitized, alert=False, comment=False, edit=False): sanitized = image_check_regex.sub(r'\1', sanitized) + sanitized = link_fix_regex.sub(r'\2https://\3', sanitized) + sanitized = markdown(sanitized) sanitized = strikethrough_regex.sub(r'\1', sanitized) diff --git a/files/routes/posts.py b/files/routes/posts.py index 26b999747..fc37e8721 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1342,6 +1342,9 @@ def submit_post(v, sub=None): body += f'* [ghostarchive.org](https://ghostarchive.org/search?term={quote(href)}) (click to archive)\n\n' gevent.spawn(archiveorg, href) + if body == '!slots': + body = f'!slots{snappy.coins}' + body_html = sanitize(body) if len(body_html) < 40000: @@ -1362,7 +1365,7 @@ def submit_post(v, sub=None): snappy.coins += 1 g.db.add(snappy) - if body.startswith('!slots1000'): + if body.startswith('!slots'): check_for_slots_command(body, snappy, c) g.db.flush() diff --git a/files/routes/users.py b/files/routes/users.py index eeb28936d..d3763c7dd 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -776,7 +776,8 @@ def messagereply(v): g.db.add(notif) ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies] - notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids)) + uids = [x.id for x in admins] + notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id.in_(uids)) for n in notifications: g.db.delete(n) diff --git a/files/templates/default.html b/files/templates/default.html index 1d47c7513..1da90f0ec 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -247,7 +247,7 @@ /h/{{sub.name}} banner {% elif SITE_NAME == 'rDrama' %} {% set path = "assets/images/" + SITE_NAME + "/banners" %} - {% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=25' %} + {% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=26' %} {% if v and (v.is_banned or v.agendaposter) %} diff --git a/seed-db.sql b/seed-db.sql index 13f9078a1..560ff80e9 100644 --- a/seed-db.sql +++ b/seed-db.sql @@ -1,27 +1,27 @@ INSERT INTO public.users (username, passhash, created_utc, admin_level, over_18, is_activated, bio, bio_html, login_nonce, is_private, unban_utc, original_username, customtitle, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor, customtitleplain, theme, themecolor, changelogsub, reddit, css, profilecss, coins, agendaposter, - post_count, comment_count, background, verified, truecoins, cardview + post_count, comment_count, background, verified, truecoins, cardview, profileurl, highres ) VALUES ('System', '', extract(epoch from now()), 0, true, true, '', '', 0, false, 0, 'System', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', '', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0, - 0, 0, '', 'Verified', 0, false), + 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/2.webp', '/assets/images/pfps/2.webp'), ('AutoJanny', '', extract(epoch from now()), 0, true, true, '', '', 0, false, 0, 'AutoJanny', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', '', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0, - 0, 0, '', 'Verified', 0, false), + 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/2.webp', '/assets/images/pfps/2.webp'), ('Snappy', '', extract(epoch from now()), 0, true, true, '', '', 0, false, 0, 'Snappy', '', 'hot', 'top', 'day', '62ca56', 'e4432d', '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, - 0, 0, '', 'Verified', 0, false), + 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/3.webp', '/assets/images/pfps/3.webp'), ('longpostbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false, 0, 'longpostbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, - 0, 0, '', 'Verified', 0, false), + 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/4.webp', '/assets/images/pfps/4.webp'), ('zozbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false, 0, 'zozbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, - 0, 0, '', 'Verified', 0, false), + 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/5.webp', '/assets/images/pfps/5.webp'), ('AutoPoller', '', extract(epoch from now()), 0, true, true, '', '', 0, false, 0, 'AutoPoller', '', 'hot', 'top', 'day', '62ca56', 'e4432d', '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, diff --git a/snappy_PCM.txt b/snappy_PCM.txt index 774d9d230..398631de5 100644 --- a/snappy_PCM.txt +++ b/snappy_PCM.txt @@ -598,7 +598,7 @@ Ayoo, you’re fat as fuck! {[para]} AVOCADO NIGGER! {[para]} -!slots1000 +!slots You’re poor, figure it out. Imagine being at the super market looking at the cost of nectors and shit. Fuck you, dude. {[para]} Want to go rape some fire hydrants? diff --git a/snappy_rDrama.txt b/snappy_rDrama.txt index e8e3552fe..ae202a10d 100644 --- a/snappy_rDrama.txt +++ b/snappy_rDrama.txt @@ -3261,7 +3261,7 @@ That I am trapped in this particular irrelevancy is never more apparent to me th {[para]} https://youtube.com/watch?v=5I884gOUONg {[para]} -!slots1000 +!slots {[para]} Fuck you. Dog walkings great. Excellent way to make side cash and get exercise, and being able to immediately make any dog fall in love with you is a skill I use on a monthly basis.