forked from rDrama/rDrama
Amend PR 52, 53: standardize style, basedbot bug
parent
f848f68799
commit
25b5675ac4
|
@ -302,8 +302,10 @@ def execute_basedbot(c:Comment, level:int, body, post_target:post_target_type, v
|
||||||
if not c.body.lower().startswith("based"): return
|
if not c.body.lower().startswith("based"): return
|
||||||
posting_to_submission = isinstance(post_target, Submission)
|
posting_to_submission = isinstance(post_target, Submission)
|
||||||
pill = based_regex.match(body)
|
pill = based_regex.match(body)
|
||||||
if level == 1: basedguy = get_account(post_target.author_id)
|
if level == 1:
|
||||||
else: basedguy = get_account(c.parent_comment.author_id)
|
basedguy = get_account(post_target.author_id) if posting_to_submission else post_target
|
||||||
|
else:
|
||||||
|
basedguy = get_account(c.parent_comment.author_id)
|
||||||
basedguy.basedcount += 1
|
basedguy.basedcount += 1
|
||||||
if pill:
|
if pill:
|
||||||
if basedguy.pills: basedguy.pills += f", {pill.group(1)}"
|
if basedguy.pills: basedguy.pills += f", {pill.group(1)}"
|
||||||
|
|
|
@ -578,7 +578,7 @@ def messagereply(v:User):
|
||||||
|
|
||||||
@app.get("/2faqr/<secret>")
|
@app.get("/2faqr/<secret>")
|
||||||
@auth_required
|
@auth_required
|
||||||
def mfa_qr(secret, v:User):
|
def mfa_qr(v:User, secret:str):
|
||||||
x = pyotp.TOTP(secret)
|
x = pyotp.TOTP(secret)
|
||||||
qr = qrcode.QRCode(
|
qr = qrcode.QRCode(
|
||||||
error_correction=qrcode.constants.ERROR_CORRECT_L
|
error_correction=qrcode.constants.ERROR_CORRECT_L
|
||||||
|
@ -715,7 +715,7 @@ def userpagelisting(user:User, site=None, v=None, page:int=1, sort="new", t="all
|
||||||
@app.get("/@<username>")
|
@app.get("/@<username>")
|
||||||
@app.get("/@<username>.json")
|
@app.get("/@<username>.json")
|
||||||
@auth_desired_with_logingate
|
@auth_desired_with_logingate
|
||||||
def u_username_wall(username:str, v:Optional[User]=None):
|
def u_username_wall(v:Optional[User], username:str):
|
||||||
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
|
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
|
||||||
if username != u.username:
|
if username != u.username:
|
||||||
return redirect(f"/@{u.username}")
|
return redirect(f"/@{u.username}")
|
||||||
|
@ -829,7 +829,7 @@ def u_username_wall_comment(v:User, username:str, cid):
|
||||||
@app.get("/@<username>/posts")
|
@app.get("/@<username>/posts")
|
||||||
@app.get("/@<username>/posts.json")
|
@app.get("/@<username>/posts.json")
|
||||||
@auth_desired_with_logingate
|
@auth_desired_with_logingate
|
||||||
def u_username(v:Optional[User]=None, username:str):
|
def u_username(v:Optional[User], username:str):
|
||||||
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
|
u = get_user(username, v=v, include_blocks=True, include_shadowbanned=False)
|
||||||
if username != u.username:
|
if username != u.username:
|
||||||
return redirect(SITE_FULL + request.full_path.replace(username, u.username))
|
return redirect(SITE_FULL + request.full_path.replace(username, u.username))
|
||||||
|
|
Loading…
Reference in New Issue