remotes/1693045480750635534/spooky-22
Aevann1 2022-01-18 13:19:32 +02:00
parent 41fcb59135
commit 9c7b981c2e
10 changed files with 60 additions and 51 deletions

View File

@ -20,8 +20,8 @@ services:
#- HCAPTCHA_SITEKEY=3435tdfsdudebussylmaoxxt43
- HCAPTCHA_SECRET=3435tdfsdudebussylmaoxxt43
- YOUTUBE_KEY=3435tdfsdudebussylmaoxxt43
#- PUSHER_ID=3435tdfsdudebussylmaoxxt43
- PUSHER_KEY=3435tdfsdudebussylmaoxxt43
- PUSHER_ID=3435tdfsdudebussylmaoxxt43
- IMGUR_KEY=3435tdfsdudebussylmaoxxt43
- SPAM_SIMILARITY_THRESHOLD=0.5
- SPAM_URL_SIMILARITY_THRESHOLD=0.1

View File

@ -122,7 +122,7 @@ def torture_ap(body, username):
LONGPOST_REPLIES = ('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.", ':#marseywoah:', '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 rdrama.net was the best option?', "I don't have enough spoons to read this shit", "All those words won't bring daddy back.", 'OUT!', "Damn, you're really mad over this, but thanks for the effort you put into typing that all out! Sadly I won't read it all.", "Jesse what the fuck are you talking about??")
AGENDAPOSTER_PHRASE = 'black lives matter'
AGENDAPOSTER_PHRASE = 'trans lives matter'
AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically removed because you forgot
to include `{AGENDAPOSTER_PHRASE}`.\n\nDon't worry, we're here to help! We
@ -787,3 +787,4 @@ NOTIFIED_USERS = {
}
num_banners = len(listdir('files/assets/images/Drama/banners')) + 1
num_sidebar = len(listdir('files/assets/images/Drama/sidebar')) + 1

View File

@ -24,4 +24,4 @@ def post_embed(id, v):
@app.context_processor
def inject_constants():
return {"num_banners":num_banners, "environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID": AUTOJANNY_ID, "NOTIFICATIONS_ID": NOTIFICATIONS_ID, "PUSHER_ID": PUSHER_ID}
return {"num_banners":num_banners, "num_sidebar":num_sidebar, "environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID": AUTOJANNY_ID, "NOTIFICATIONS_ID": NOTIFICATIONS_ID, "PUSHER_ID": PUSHER_ID}

View File

@ -245,10 +245,12 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False):
htmlsource += '"></lite-youtube>'
sanitized = sanitized.replace(replacing, htmlsource)
for i in re.finditer('>(https://.*?\.(mp4|webm|mov))</a></p>', sanitized):
sanitized = sanitized.replace(f'<p><a href="{i.group(1)}" rel="nofollow noopener noreferrer" target="_blank">{i.group(1)}</a></p>', f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
for i in re.finditer('<p>(https:.*?\.(mp4|webm|mov))</p>', sanitized):
sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
if not noimages:
for i in re.finditer('>(https://.*?\.(mp4|webm|mov))</a></p>', sanitized):
sanitized = sanitized.replace(f'<p><a href="{i.group(1)}" rel="nofollow noopener noreferrer" target="_blank">{i.group(1)}</a></p>', f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
for i in re.finditer('<p>(https:.*?\.(mp4|webm|mov))</p>', sanitized):
sanitized = sanitized.replace(i.group(0), f'<p><video controls preload="none" class="embedvid"><source src="{i.group(1)}" type="video/{i.group(2)}"></video>')
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]:
sanitized = sanitized.replace(rd, "://old.reddit.com")

View File

@ -16,10 +16,7 @@ if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN"
else: cc = "COUNTRY CLUB"
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
beams_client = PushNotifications(
instance_id=PUSHER_ID,
secret_key=PUSHER_KEY,
)
if PUSHER_ID: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
@app.get("/comment/<cid>")
@app.get("/post/<pid>/<anything>/<cid>")
@ -161,7 +158,7 @@ def api_comment(v):
body = request.values.get("body", "").strip()[:10000]
if v.marseyawarded:
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
@ -332,7 +329,7 @@ def api_comment(v):
g.db.add(c)
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment')
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body)
@ -465,7 +462,7 @@ def api_comment(v):
n = Notification(comment_id=c.id, user_id=x)
g.db.add(n)
if parent.author.id != v.id:
if parent.author.id != v.id and PUSHER_ID:
if len(c.body) > 500: notifbody = c.body[:500] + '...'
else: notifbody = c.body
@ -561,7 +558,7 @@ def edit_comment(cid, v):
if body != c.body or request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
if v.marseyawarded:
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
@ -674,7 +671,7 @@ def edit_comment(cid, v):
g.db.add(c)
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment')
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body)

View File

@ -403,10 +403,10 @@ def edit_post(pid, v):
if len(body) > 10000: return {"error":"Character limit is 10000!"}, 403
if v.marseyawarded:
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", title))
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if body:
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
@ -483,7 +483,7 @@ def edit_post(pid, v):
g.db.add(p)
body = AGENDAPOSTER_MSG.format(username=v.username, type='post')
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body)
@ -789,10 +789,10 @@ def submit_post(v):
else: render_template("submit.html", v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
if v.marseyawarded:
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", title))
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if body:
marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body))
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body))
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
@ -1013,7 +1013,7 @@ def submit_post(v):
new_post.is_banned = True
new_post.ban_reason = "AutoJanny"
body = AGENDAPOSTER_MSG.format(username=v.username, type='post')
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
body_jannied_html = sanitize(body)

View File

@ -14,7 +14,7 @@ from collections import Counter
site = environ.get("DOMAIN").strip()
beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
if PUSHER_ID: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY)
db = db_session()
@ -442,31 +442,32 @@ def message2(v, username):
notif = Notification(comment_id=new_comment.id, user_id=user.id)
g.db.add(notif)
if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message
if PUSHER_ID:
if len(message) > 500: notifbody = message[:500] + '...'
else: notifbody = message
beams_client.publish_to_interests(
interests=[f'{request.host}{user.id}'],
publish_body={
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'https://{site}/notifications?messages=true',
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
beams_client.publish_to_interests(
interests=[f'{request.host}{user.id}'],
publish_body={
'web': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
'deep_link': f'https://{site}/notifications?messages=true',
'icon': f'https://{request.host}/assets/images/{SITE_NAME}/icon.webp',
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': 'notifications?messages=true',
}
}
},
'fcm': {
'notification': {
'title': f'New message from @{v.username}',
'body': notifbody,
},
'data': {
'url': 'notifications?messages=true',
}
}
},
)
)
g.db.commit()
@ -505,7 +506,7 @@ def messagereply(v):
g.db.add(new_comment)
g.db.flush()
if user_id != v.id:
if PUSHER_ID and user_id != v.id:
notif = Notification(comment_id=new_comment.id, user_id=user_id)
g.db.add(notif)

View File

@ -226,9 +226,17 @@
</style>
{% if v %}
<a href="{% if request.host == 'rdrama.net' %}https://secure.transequality.org/site/Donation2?df_id=1480{% else %}/{% endif %}">
<img class="banner" alt="site banner" src="/static/assets/images/{{SITE_NAME}}/banner.webp?a=10" width="100%">
</a>
{% if SITE_NAME == 'Drama' %}
<a href="https://secure.transequality.org/site/Donation2?df_id=1480">
<img class="banner" alt="site banner" src="/static/assets/images/{{SITE_NAME}}/banners/{{range(1,num_banners)|random()}}.webp?a=16" width="100%">
</a>
{% else %}
<a href="/">
<img class="banner" alt="site banner" src="/static/assets/images/{{SITE_NAME}}/banner.webp?a=10" width="100%">
</a>
{% endif %}
{% else %}
<a href="/login">
<img class="banner" alt="site banner" src="/static/assets/images/{{SITE_NAME}}/cached.webp?a=7" width="100%">

View File

@ -165,7 +165,7 @@
</nav>
{% endif %}
{% if v %}
{% if PUSHER_ID and v %}
<div class="d-none" id="strid">{{request.host}}{{v.id}}</div>
<div class="d-none" id="pusherid">{{PUSHER_ID}}</div>
<script src="/static/assets/js/pusher.js?a=202"></script>

View File

@ -1,6 +1,6 @@
<div class="col sidebar text-left d-none d-lg-block pt-3 bg-white" style="max-width:300px">
{% set image = "/static/assets/images/" + SITE_NAME + "/banners/" + range(1,num_banners)|random()|string + ".webp?a=15" %}
{% set image = "/static/assets/images/" + SITE_NAME + "/sidebar/" + range(1,num_sidebar)|random()|string + ".webp?a=15" %}
<a role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" data-bs-url="{{image}}" onclick="expandDesktopImage('{{image}}')">
<img loading="lazy" src="{{image}}" width=100%>