Merge branch 'master' into master
commit
6d6e95882c
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
|
@ -8,6 +8,7 @@ from sqlalchemy.orm import aliased, deferred, Query
|
||||||
from sqlalchemy.sql import case, func, literal
|
from sqlalchemy.sql import case, func, literal
|
||||||
from sqlalchemy.sql.expression import not_, and_, or_
|
from sqlalchemy.sql.expression import not_, and_, or_
|
||||||
from sqlalchemy.sql.sqltypes import *
|
from sqlalchemy.sql.sqltypes import *
|
||||||
|
from sqlalchemy.exc import OperationalError
|
||||||
from flask import g, session, request
|
from flask import g, session, request
|
||||||
|
|
||||||
from files.classes import Base
|
from files.classes import Base
|
||||||
|
@ -209,7 +210,12 @@ class User(Base):
|
||||||
user_query = g.db.query(User).options(load_only(User.id)).filter_by(id=self.id)
|
user_query = g.db.query(User).options(load_only(User.id)).filter_by(id=self.id)
|
||||||
|
|
||||||
if currency == 'coins':
|
if currency == 'coins':
|
||||||
|
try:
|
||||||
user_query.update({ User.coins: User.coins + amount })
|
user_query.update({ User.coins: User.coins + amount })
|
||||||
|
except OperationalError as e:
|
||||||
|
if str(e).startswith('(psycopg2.errors.QueryCanceled) canceling statement due to statement timeout'):
|
||||||
|
abort(409, f"Statement timeout while trying to pay @{self.username} {amount} coins!")
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
user_query.update({ User.marseybux: User.marseybux + amount })
|
user_query.update({ User.marseybux: User.marseybux + amount })
|
||||||
|
|
||||||
|
|
|
@ -410,14 +410,13 @@ PERMS = { # Minimum admin_level to perform action.
|
||||||
'POST_COMMENT_INFINITE_PINGS': 2,
|
'POST_COMMENT_INFINITE_PINGS': 2,
|
||||||
'IGNORE_1WEEk_EDITING_LIMIT': 2,
|
'IGNORE_1WEEk_EDITING_LIMIT': 2,
|
||||||
'ORGIES': 2,
|
'ORGIES': 2,
|
||||||
|
'POST_BETS': 2,
|
||||||
|
'POST_BETS_DISTRIBUTE': 2,
|
||||||
|
|
||||||
'ADMIN_REMOVE': 3,
|
'ADMIN_REMOVE': 3,
|
||||||
'ADMIN_ACTIONS_REVERT': 3,
|
'ADMIN_ACTIONS_REVERT': 3,
|
||||||
'DOMAINS_BAN': 3,
|
'DOMAINS_BAN': 3,
|
||||||
'EDIT_RULES': 3,
|
'EDIT_RULES': 3,
|
||||||
'POST_BETS': 3,
|
|
||||||
'POST_BETS_DISTRIBUTE': 3,
|
|
||||||
'VIEW_PENDING_SUBMITTED_HATS': 3,
|
|
||||||
'LOTTERY_ADMIN': 3,
|
'LOTTERY_ADMIN': 3,
|
||||||
'SITE_SETTINGS': 3,
|
'SITE_SETTINGS': 3,
|
||||||
'SITE_CACHE_PURGE_CDN': 3,
|
'SITE_CACHE_PURGE_CDN': 3,
|
||||||
|
@ -728,6 +727,7 @@ if SITE == 'rdrama.net':
|
||||||
'pewkie': 28,
|
'pewkie': 28,
|
||||||
'homocracy': 147,
|
'homocracy': 147,
|
||||||
'donger': 541,
|
'donger': 541,
|
||||||
|
'soren': 2546,
|
||||||
'marseyismywaifu': 3377,
|
'marseyismywaifu': 3377,
|
||||||
'mimw': 3377,
|
'mimw': 3377,
|
||||||
'heymoon': 3635,
|
'heymoon': 3635,
|
||||||
|
|
|
@ -38,7 +38,8 @@ def cron_fn(every_5m, every_1d):
|
||||||
check_if_end_lottery_task()
|
check_if_end_lottery_task()
|
||||||
|
|
||||||
spin_roulette_wheel()
|
spin_roulette_wheel()
|
||||||
#offsitementions.offsite_mentions_task(cache)
|
t = time.time()
|
||||||
|
offsitementions.offsite_mentions_task(cache)
|
||||||
_award_timers_task()
|
_award_timers_task()
|
||||||
_unpin_expired()
|
_unpin_expired()
|
||||||
_grant_one_year_badges()
|
_grant_one_year_badges()
|
||||||
|
|
|
@ -38,18 +38,15 @@ def get_mentions(cache, queries, reddit_notifs_users=False):
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
for query in queries:
|
for query in queries:
|
||||||
last_processed = 9999999999
|
url = f'https://api.pullpush.io/reddit/search/{kind}?q={query}'
|
||||||
while True:
|
data += requests.get(url, headers=HEADERS, timeout=5, proxies=proxies).json()['data']
|
||||||
url = f'https://api.pullpush.io/reddit/search/{kind}?q={query}&before={last_processed}'
|
|
||||||
new_data = requests.get(url, headers=HEADERS, timeout=5, proxies=proxies).json()['data']
|
|
||||||
data += new_data
|
|
||||||
try: last_processed = int(new_data[-1]['created_utc'])
|
|
||||||
except: break
|
|
||||||
if last_processed < 1682872206 or len(new_data) < 100: break
|
|
||||||
|
|
||||||
data = sorted(data, key=lambda x: x['created_utc'], reverse=True)
|
data = sorted(data, key=lambda x: int(x['created_utc']), reverse=True)
|
||||||
|
|
||||||
for thing in data:
|
for thing in data:
|
||||||
|
if not thing.get('permalink'):
|
||||||
|
continue
|
||||||
|
|
||||||
if thing['subreddit'] in {'IAmA', 'PokemonGoRaids', 'SubSimulatorGPT2', 'SubSimGPT2Interactive'}: continue
|
if thing['subreddit'] in {'IAmA', 'PokemonGoRaids', 'SubSimulatorGPT2', 'SubSimGPT2Interactive'}: continue
|
||||||
if 'bot' in thing['author'].lower(): continue
|
if 'bot' in thing['author'].lower(): continue
|
||||||
if 'AutoModerator' == thing['author']: continue
|
if 'AutoModerator' == thing['author']: continue
|
||||||
|
@ -66,7 +63,6 @@ def get_mentions(cache, queries, reddit_notifs_users=False):
|
||||||
if thing["selftext"]:
|
if thing["selftext"]:
|
||||||
selftext = thing["selftext"].replace('>', '> ')[:5000]
|
selftext = thing["selftext"].replace('>', '> ')[:5000]
|
||||||
text += f'<br><blockquote><p>{selftext}</p></blockquote>'
|
text += f'<br><blockquote><p>{selftext}</p></blockquote>'
|
||||||
|
|
||||||
mentions.append({
|
mentions.append({
|
||||||
'permalink': thing['permalink'],
|
'permalink': thing['permalink'],
|
||||||
'author': thing['author'],
|
'author': thing['author'],
|
||||||
|
@ -94,7 +90,7 @@ def notify_mentions(mentions, send_to=None, mention_str='site mention'):
|
||||||
author_id=const.AUTOJANNY_ID,
|
author_id=const.AUTOJANNY_ID,
|
||||||
parent_post=None,
|
parent_post=None,
|
||||||
body_html=notif_text).one_or_none()
|
body_html=notif_text).one_or_none()
|
||||||
if existing_comment: continue
|
if existing_comment: break
|
||||||
|
|
||||||
new_comment = Comment(
|
new_comment = Comment(
|
||||||
author_id=const.AUTOJANNY_ID,
|
author_id=const.AUTOJANNY_ID,
|
||||||
|
|
|
@ -3,14 +3,22 @@ from flask import g
|
||||||
from files.classes.badges import Badge
|
from files.classes.badges import Badge
|
||||||
from files.helpers.alerts import send_repeatable_notification
|
from files.helpers.alerts import send_repeatable_notification
|
||||||
|
|
||||||
def badge_grant(user, badge_id, notify=True, check_if_exists=True):
|
def badge_grant(user, badge_id, description=None, url=None, notify=True):
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
existing = g.db.query(Badge).filter_by(user_id=user.id, badge_id=badge_id).one_or_none()
|
existing = g.db.query(Badge).filter_by(user_id=user.id, badge_id=badge_id).one_or_none()
|
||||||
if existing: return
|
if existing: return
|
||||||
|
|
||||||
|
if description and len(description) > 256:
|
||||||
|
abort(400, "Custom description is too long, max 256 characters!")
|
||||||
|
|
||||||
|
if url and len(url) > 256:
|
||||||
|
abort(400, "URL is too long, max 256 characters!")
|
||||||
|
|
||||||
badge = Badge(
|
badge = Badge(
|
||||||
badge_id=int(badge_id),
|
badge_id=int(badge_id),
|
||||||
user_id=user.id,
|
user_id=user.id,
|
||||||
|
description=description,
|
||||||
|
url=url,
|
||||||
)
|
)
|
||||||
|
|
||||||
g.db.add(badge)
|
g.db.add(badge)
|
||||||
|
|
|
@ -145,6 +145,9 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, filter_words='
|
||||||
to_remove += [x.id for x in posts if x.sub == h][1:]
|
to_remove += [x.id for x in posts if x.sub == h][1:]
|
||||||
|
|
||||||
posts = [x for x in posts if x.id not in to_remove][:size]
|
posts = [x for x in posts if x.id not in to_remove][:size]
|
||||||
|
elif SITE_NAME == 'WPD' and not v and sub == None:
|
||||||
|
posts = posts.limit(200).all()
|
||||||
|
posts = [x for x in posts if x.sub not in {'pets','selfharm'}][:size]
|
||||||
else:
|
else:
|
||||||
posts = posts.limit(size).all()
|
posts = posts.limit(size).all()
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ def template_asset(ctx, asset_path):
|
||||||
def template_change_arg(arg, value, url):
|
def template_change_arg(arg, value, url):
|
||||||
parsed = urlsplit(url)
|
parsed = urlsplit(url)
|
||||||
query_dict = parse_qs(parsed.query)
|
query_dict = parse_qs(parsed.query)
|
||||||
|
query_dict.pop('page', None)
|
||||||
query_dict[arg] = value
|
query_dict[arg] = value
|
||||||
query_new = urlencode(query_dict, doseq=True)
|
query_new = urlencode(query_dict, doseq=True)
|
||||||
parsed = parsed._replace(query=query_new)
|
parsed = parsed._replace(query=query_new)
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
LOG='/var/log/rdrama/cron.log'
|
LOG='/var/log/rdrama/cron.log'
|
||||||
|
|
||||||
echo -e "\n---------------------------------------- $1 === $(date --iso-8601=minutes)" >> "$LOG"
|
echo -e "\n---------------------------------------- $1 === $(date)" >> "$LOG"
|
||||||
|
|
||||||
source /e
|
source /e
|
||||||
. .env
|
. .env
|
||||||
/usr/local/bin/flask cron $1 >> "$LOG" 2>&1
|
/usr/local/bin/flask cron $1 >> "$LOG" 2>&1
|
||||||
|
|
||||||
echo -e "======================================== $1 === $(date --iso-8601=minutes)" >> "$LOG"
|
echo -e "======================================== $1 === $(date)" >> "$LOG"
|
||||||
|
|
|
@ -3386,3 +3386,9 @@ https://i.watchpeopledie.tv/images/16941242189402223.webp
|
||||||
~~wrong flair~~
|
~~wrong flair~~
|
||||||
|
|
||||||
edit: nvm apparently the admins removed h/RetardedShitNoOneCaresAbout
|
edit: nvm apparently the admins removed h/RetardedShitNoOneCaresAbout
|
||||||
|
{[para]}
|
||||||
|
Woah dude, bagging a puppy and throwing it in a lake really isn't cool. What the fuck?
|
||||||
|
{[para]}
|
||||||
|
How’s that job going? Still working at the gay retard factory?
|
||||||
|
{[para]}
|
||||||
|
Instead of saying “speaking as a woman”, just make your point without the preamble. People will know that you’re a woman by noticing that what you’re saying is wrong.
|
|
@ -4321,3 +4321,16 @@ https://i.rdrama.net/images/1694199268584252.webp
|
||||||
https://i.rdrama.net/images/16942263739404266.webp
|
https://i.rdrama.net/images/16942263739404266.webp
|
||||||
{[para]}
|
{[para]}
|
||||||
We serve food here sir
|
We serve food here sir
|
||||||
|
|
||||||
|
{[para]}
|
||||||
|
https://i.rdrama.net/images/1694292697905747.webp
|
||||||
|
{[para]}
|
||||||
|
Instead of starting your post with “as a woman”, skip the preamble and just make the comment as usual. People will know you are a woman by noticing that what you say is wrong.
|
||||||
|
{[para]}
|
||||||
|
https://i.rdrama.net/images/16943718404956486.webp
|
||||||
|
{[para]}
|
||||||
|
https://i.rdrama.net/images/16943940331777716.webp
|
||||||
|
{[para]}
|
||||||
|
https://i.rdrama.net/images/16944418680771964.webp
|
||||||
|
{[para]}
|
||||||
|
https://i.rdrama.net/images/16944446074379375.webp
|
Loading…
Reference in New Issue