Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

master
Aevann1 2022-10-15 19:03:53 +02:00
commit 129508b163
4 changed files with 10 additions and 5 deletions

View File

@ -9,6 +9,11 @@ import user_agents
import time import time
def calc_users(v): def calc_users(v):
# Some globals we expect aren't available when rendering error pages
if (not g or not hasattr(g, 'agent')
or not session or not ('session_id' in session)):
return ''
loggedin = cache.get(f'{SITE}_loggedin') or {} loggedin = cache.get(f'{SITE}_loggedin') or {}
loggedout = cache.get(f'{SITE}_loggedout') or {} loggedout = cache.get(f'{SITE}_loggedout') or {}
timestamp = int(time.time()) timestamp = int(time.time())

View File

@ -255,7 +255,9 @@ def comment(v):
if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']: if parent.author.any_block_exists(v) and v.admin_level < PERMS['POST_COMMENT_MODERATION']:
abort(403, "You can't reply to users who have blocked you or users that you have blocked.") abort(403, "You can't reply to users who have blocked you or users that you have blocked.")
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID) is_bot = (v.client is not None
and v.id != BBBB_ID
or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID))
execute_antispam_comment_check(body, v) execute_antispam_comment_check(body, v)

View File

@ -877,8 +877,6 @@ def submit_post(v, sub=None):
if embed and len(embed) > 1500: embed = None if embed and len(embed) > 1500: embed = None
is_bot = v.id != BBBB_ID and v.client or (SITE == 'pcmemes.net' and v.id == SNAPPY_ID)
if request.values.get("ghost") and v.coins >= 100: if request.values.get("ghost") and v.coins >= 100:
v.charge_account('coins', 100) v.charge_account('coins', 100)
ghost = True ghost = True
@ -894,7 +892,7 @@ def submit_post(v, sub=None):
over_18=bool(request.values.get("over_18","")), over_18=bool(request.values.get("over_18","")),
new=bool(request.values.get("new","")), new=bool(request.values.get("new","")),
app_id=v.client.application.id if v.client else None, app_id=v.client.application.id if v.client else None,
is_bot = is_bot, is_bot=(v.client is not None),
url=url, url=url,
body=body, body=body,
body_html=body_html, body_html=body_html,

View File

@ -913,7 +913,7 @@ def u_username_comments(username, v=None):
listing = get_comments(ids, v=v) listing = get_comments(ids, v=v)
if v.client or request.path.endswith(".json"): if (v and v.client) or request.path.endswith(".json"):
return {"data": [c.json for c in listing]} return {"data": [c.json for c in listing]}
return render_template("userpage_comments.html", u=user, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) return render_template("userpage_comments.html", u=user, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True)