Merge branch 'master' of https://fsdfsd.net/transbitch/rDrama
commit
b053e0cb6e
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.expression import not_, and_, or_
|
||||
from sqlalchemy.sql.sqltypes import *
|
||||
from sqlalchemy.exc import OperationalError
|
||||
from flask import g, session, request
|
||||
|
||||
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)
|
||||
|
||||
if currency == 'coins':
|
||||
user_query.update({ User.coins: User.coins + amount })
|
||||
try:
|
||||
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:
|
||||
user_query.update({ User.marseybux: User.marseybux + amount })
|
||||
|
||||
|
|
|
@ -410,14 +410,13 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'POST_COMMENT_INFINITE_PINGS': 2,
|
||||
'IGNORE_1WEEk_EDITING_LIMIT': 2,
|
||||
'ORGIES': 2,
|
||||
'POST_BETS': 2,
|
||||
'POST_BETS_DISTRIBUTE': 2,
|
||||
|
||||
'ADMIN_REMOVE': 3,
|
||||
'ADMIN_ACTIONS_REVERT': 3,
|
||||
'DOMAINS_BAN': 3,
|
||||
'EDIT_RULES': 3,
|
||||
'POST_BETS': 3,
|
||||
'POST_BETS_DISTRIBUTE': 3,
|
||||
'VIEW_PENDING_SUBMITTED_HATS': 3,
|
||||
'LOTTERY_ADMIN': 3,
|
||||
'SITE_SETTINGS': 3,
|
||||
'SITE_CACHE_PURGE_CDN': 3,
|
||||
|
@ -728,6 +727,7 @@ if SITE == 'rdrama.net':
|
|||
'pewkie': 28,
|
||||
'homocracy': 147,
|
||||
'donger': 541,
|
||||
'soren': 2546,
|
||||
'marseyismywaifu': 3377,
|
||||
'mimw': 3377,
|
||||
'heymoon': 3635,
|
||||
|
|
|
@ -38,7 +38,8 @@ def cron_fn(every_5m, every_1d):
|
|||
check_if_end_lottery_task()
|
||||
|
||||
spin_roulette_wheel()
|
||||
#offsitementions.offsite_mentions_task(cache)
|
||||
t = time.time()
|
||||
offsitementions.offsite_mentions_task(cache)
|
||||
_award_timers_task()
|
||||
_unpin_expired()
|
||||
_grant_one_year_badges()
|
||||
|
|
|
@ -38,18 +38,15 @@ def get_mentions(cache, queries, reddit_notifs_users=False):
|
|||
data = []
|
||||
|
||||
for query in queries:
|
||||
last_processed = 9999999999
|
||||
while True:
|
||||
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
|
||||
url = f'https://api.pullpush.io/reddit/search/{kind}?q={query}'
|
||||
data += requests.get(url, headers=HEADERS, timeout=5, proxies=proxies).json()['data']
|
||||
|
||||
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:
|
||||
if not thing.get('permalink'):
|
||||
continue
|
||||
|
||||
if thing['subreddit'] in {'IAmA', 'PokemonGoRaids', 'SubSimulatorGPT2', 'SubSimGPT2Interactive'}: continue
|
||||
if 'bot' in thing['author'].lower(): continue
|
||||
if 'AutoModerator' == thing['author']: continue
|
||||
|
@ -66,7 +63,6 @@ def get_mentions(cache, queries, reddit_notifs_users=False):
|
|||
if thing["selftext"]:
|
||||
selftext = thing["selftext"].replace('>', '> ')[:5000]
|
||||
text += f'<br><blockquote><p>{selftext}</p></blockquote>'
|
||||
|
||||
mentions.append({
|
||||
'permalink': thing['permalink'],
|
||||
'author': thing['author'],
|
||||
|
@ -94,7 +90,7 @@ def notify_mentions(mentions, send_to=None, mention_str='site mention'):
|
|||
author_id=const.AUTOJANNY_ID,
|
||||
parent_post=None,
|
||||
body_html=notif_text).one_or_none()
|
||||
if existing_comment: continue
|
||||
if existing_comment: break
|
||||
|
||||
new_comment = Comment(
|
||||
author_id=const.AUTOJANNY_ID,
|
||||
|
|
|
@ -3,14 +3,22 @@ from flask import g
|
|||
from files.classes.badges import Badge
|
||||
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()
|
||||
existing = g.db.query(Badge).filter_by(user_id=user.id, badge_id=badge_id).one_or_none()
|
||||
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_id=int(badge_id),
|
||||
user_id=user.id,
|
||||
description=description,
|
||||
url=url,
|
||||
)
|
||||
|
||||
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:]
|
||||
|
||||
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:
|
||||
posts = posts.limit(size).all()
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ def template_asset(ctx, asset_path):
|
|||
def template_change_arg(arg, value, url):
|
||||
parsed = urlsplit(url)
|
||||
query_dict = parse_qs(parsed.query)
|
||||
query_dict.pop('page', None)
|
||||
query_dict[arg] = value
|
||||
query_new = urlencode(query_dict, doseq=True)
|
||||
parsed = parsed._replace(query=query_new)
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
LOG='/var/log/rdrama/cron.log'
|
||||
|
||||
echo -e "\n---------------------------------------- $1 === $(date --iso-8601=minutes)" >> "$LOG"
|
||||
echo -e "\n---------------------------------------- $1 === $(date)" >> "$LOG"
|
||||
|
||||
source /e
|
||||
. .env
|
||||
/usr/local/bin/flask cron $1 >> "$LOG" 2>&1
|
||||
|
||||
echo -e "======================================== $1 === $(date --iso-8601=minutes)" >> "$LOG"
|
||||
echo -e "======================================== $1 === $(date)" >> "$LOG"
|
||||
|
|
|
@ -3385,4 +3385,10 @@ https://i.watchpeopledie.tv/images/16941242189402223.webp
|
|||
{[para]}
|
||||
~~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
|
||||
{[para]}
|
||||
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