remotes/1693045480750635534/spooky-22
Aevann1 2022-01-07 21:13:01 +02:00
parent 00bdd2d1c2
commit 8a0d51c4e0
9 changed files with 80 additions and 19 deletions

View File

@ -104,8 +104,18 @@ def NOTIFY_USERS(text, v):
soup = BeautifulSoup(text, features="html.parser")
for mention in soup.find_all("a", href=re.compile("^\/id\/([0-9]+)")):
id = int(mention["href"].split("/id/")[1])
if id != v.id:
user = g.db.query(User).filter_by(id=id).one_or_none()
if user and not v.any_block_exists(user): notify_users.add(user.id)
if id != v.id: notify_users.add(id)
return notify_users
def NOTIFY_USERS2(text, v):
notify_users = set()
for word, id in NOTIFIED_USERS.items():
if id == 0: continue
if word in text.lower() and id not in notify_users and v.id != id: notify_users.add(id)
for i in re.finditer("(^|\s|\n)@((\w|-){1,25})", text):
user = get_user(i.group(2), graceful=True)
if user and not v.any_block_exists(user): notify_users.add(user.id)
return notify_users

View File

@ -39,6 +39,7 @@ class CustomRenderer(HTMLRenderer):
user = get_user(target, graceful=True)
if g.v.admin_level == 0 and g.v.any_block_exists(user): return f"{space}@{target}"
if not user: return f"{space}@{target}"
@ -67,6 +68,8 @@ class Renderer(HTMLRenderer):
user = get_user(target, graceful=True)
if g.v.admin_level == 0 and g.v.any_block_exists(user): return f"{space}@{target}"
if not user: return f"{space}@{target}"
return f'{space}<a href="/id/{user.id}">@{user.username}</a>'

View File

@ -600,8 +600,10 @@ def admin_userawards_post(v):
note = ""
for key, value in notify_awards.items():
note += f"{value} {AWARDS[key]['title']} {'Awards' if value != 1 else 'Award'}, "
note += f"{value} {AWARDS[key]['title']}, "
if len(note) > 256: return {"error": "You're giving too many awards at the same time!"}
ma=ModAction(
kind="grant_awards",
user_id=v.id,

View File

@ -15,7 +15,7 @@ from io import BytesIO
from files.__main__ import app, limiter, cache, db_session
from PIL import Image as PILimage
from .front import frontlist, changeloglist
from urllib.parse import ParseResult, urlunparse, urlparse, quote
from urllib.parse import ParseResult, urlunparse, urlparse, quote, unquote
from os import path
import requests
from shutil import copyfile
@ -57,7 +57,7 @@ def publish(pid, v):
post.created_utc = int(time.time())
g.db.add(post)
notify_users = NOTIFY_USERS(f'{post.body_html}{post.title}', v)
notify_users = NOTIFY_USERS(post.body_html, v) | NOTIFY_USERS2(post.title, v)
cid = notif_comment(f"@{v.username} has mentioned you: [{post.title}]({post.permalink})")
for x in notify_users:
@ -526,7 +526,7 @@ def edit_post(pid, v):
g.db.add(n)
notify_users = NOTIFY_USERS(f'{body_html}{title}', v)
notify_users = NOTIFY_USERS(body_html, v) | NOTIFY_USERS2(title, v)
soup = BeautifulSoup(body_html, features="html.parser")
@ -745,13 +745,14 @@ def submit_post(v):
url = urlunparse(new_url)
repost = g.db.query(Submission).filter(
Submission.url.ilike(url),
Submission.deleted_utc == 0,
Submission.is_banned == False
).one_or_none()
if SITE != 'localhost':
repost = g.db.query(Submission).filter(
Submission.url.ilike(url),
Submission.deleted_utc == 0,
Submission.is_banned == False
).one_or_none()
if repost: return redirect(repost.permalink)
if repost: return redirect(repost.permalink)
domain_obj = get_domain(domain)
if domain_obj:
@ -763,6 +764,7 @@ def submit_post(v):
try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"]
except: embed = None
elif url.startswith('https://youtube.com/watch?v='):
url = unquote(url).replace('?t', '&t')
yt_id = url.split('https://youtube.com/watch?v=')[1].split('&')[0].split('%')[0]
params = parse_qs(urlparse(url).query)
t = params.get('t', params.get('start', [0]))[0]
@ -1018,7 +1020,7 @@ def submit_post(v):
if not new_post.private:
notify_users = NOTIFY_USERS(f'{body_html}{title}', v)
notify_users = NOTIFY_USERS(body_html, v) | NOTIFY_USERS2(title, v)
cid = notif_comment(f"@{v.username} has mentioned you: [{title}]({new_post.permalink})")
for x in notify_users:

View File

@ -103,10 +103,10 @@ def cached_chart(days):
if days > 31:
file = "/weekly_chart.png"
day_cutoffs = [today_cutoff - 86400 * 7 * i for i in range(30)][1:]
day_cutoffs = [today_cutoff - 86400 * 7 * i for i in range(35)][1:]
else:
file = "/daily_chart.png"
day_cutoffs = [today_cutoff - 86400 * i for i in range(30)][1:]
day_cutoffs = [today_cutoff - 86400 * i for i in range(35)][1:]
day_cutoffs.insert(0, calendar.timegm(now))

View File

@ -193,7 +193,7 @@
{% endif %}
{% if c.bannedfor %}
<a role="button"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="User was banned for this comment by @{{c.author.banned_by.username}}"></i></a>
<a role="button"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="User was banned for this comment{% if c.author.banned_by %} by @{{c.author.banned_by.username}}{% endif %}"></i></a>
{% endif %}
{% if c.active_flags %}<a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" role="button" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Reports</a>{% endif %}
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}

View File

@ -329,7 +329,7 @@
<div class="post-meta text-left mb-2">
{% if p.bannedfor %}
<a role="button"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="User was banned for this post by @{{p.author.banned_by.username}}"></i></a>
<a role="button"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="User was banned for this post{% if p.author.banned_by %} by @{{p.author.banned_by.username}}{% endif %}"></i></a>
{% endif %}
{% if p.awards %}

View File

@ -167,7 +167,7 @@
<div class="post-meta text-left x-scroll mb-md-2">
{% if p.bannedfor %}
<a role="button"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="User was banned for this post by @{{p.author.banned_by.username}}"></i></a>
<a role="button"><i class="fad fa-gavel text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-original-title="User was banned for this post{% if p.author.banned_by %} by @{{p.author.banned_by.username}}{% endif %}"></i></a>
{% endif %}
{% if p.awards %}

View File

@ -2794,4 +2794,48 @@ VR, for those who are piling on without actually using it, are probably unaware
One time, there was guy directly behind me an my nephews, and he was talking to his kid the whole time. Turned around and told him to STFU it is rude. The guy started giving me shit, saying how he was going to beat the shit out of me after the movie. As the movie ended, I stood up and turned around to see what he was going to do. He and his kid bolted out right away and all I saw was a glimpse of him as he walked quickly out of there. Anyways, I never see a problem with confronting people. You should say something to those people. And if they don't shut up, just grab the baby out of their hands and throw the kid as hard as you can against the screen and start shouting over and over, "See what you made me do!!??" That'll teach them.
{[para]}
First
{[para]}
Carp bows to Bardfinn.
In contact with Admin
Possess woman-like abilities.
Control Internet with an iron but fair fist.
Own over 60 subreddits globally.
Will bankroll the first reddit on Mars (Bardit will be be the first reddit).
Direct descendants of the ancient royal blood lines.
Can destroy entire subreddits with a single email.
Own 99% of DNA editing research facilities on Earth.
First designer babies will in all likelihood be Bardfinn babies.
Is said to have 215+ IQ, such intelligence on Earth has only existed deep in Tibetan monasteries & Area 51.
Ancient Indian scriptures tell of one angels who will descend upon Earth and will bring an era of enlightenment and unprecedented technological progress with them.
The Tunguska event in 1908 was actually the Bardfinn arriving on planet Earth. How else do you think they got their birthing person last name and how else do you explain the exponential acceleration in technological and scientific development since then?
They own Nanobot R&D labs around the world.
You likely have Bardbots inside you right now.
Bardfinn is in regular communication with Aimee Challenor, forwarding the word of Spez to the average redditor. Who do you think set up the meeting between the wins & the Chapo Traphouse high command (First meeting between the two organisations in over 1000 years) and arranged the Reddit leaders first trip to Antarctica in history literally a few days later to the Bardfinn bunker in Wilkes land?
They learned fluent French in under a week.
Invented post-anabelian froeboid geometrics, a complex field of mathematics which only they can comprehend fully.
Nation states entrust their gold reserves with them. Theres no gold in Ft. Knox, only Ft. Bardfinn.
All major philosophers and scientists have made reference to them in one way or another.
She is about 7 decades old, from the space-time reference point of the base human currently accepted by our society.
In reality, she is a timeless being existing in all points of time and space from the big bang to the end of the universe. We dont know her ultimate plans yet. We hope she's a benevolent being.
{[para]}