forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-09-23 22:15:08 +02:00
parent 0a4b4262be
commit 997aa01126
1 changed files with 8 additions and 15 deletions

View File

@ -146,6 +146,7 @@ def settings_profile_post(v):
v.bio = bio[:1500] v.bio = bio[:1500]
v.bio_html=bio_html v.bio_html=bio_html
g.db.add(v) g.db.add(v)
g.db.commit()
return render_template("settings_profile.html", return render_template("settings_profile.html",
v=v, v=v,
msg="Your bio has been updated.") msg="Your bio has been updated.")
@ -161,6 +162,7 @@ def settings_profile_post(v):
v.custom_filter_list=filters v.custom_filter_list=filters
g.db.add(v) g.db.add(v)
g.db.commit()
return render_template("settings_profile.html", return render_template("settings_profile.html",
v=v, v=v,
msg="Your custom filters have been updated.") msg="Your custom filters have been updated.")
@ -477,9 +479,7 @@ def settings_log_out_others(v):
submitted_password = request.values.get("password", "") submitted_password = request.values.get("password", "")
if not v.verifyPass(submitted_password): if not v.verifyPass(submitted_password): return render_template("settings_security.html", v=v, error="Incorrect Password"), 401
return render_template("settings_security.html",
v=v, error="Incorrect Password"), 401
# increment account's nonce # increment account's nonce
v.login_nonce += 1 v.login_nonce += 1
@ -491,8 +491,7 @@ def settings_log_out_others(v):
g.db.commit() g.db.commit()
return render_template("settings_security.html", v=v, return render_template("settings_security.html", v=v, msg="All other devices have been logged out")
msg="All other devices have been logged out")
@app.post("/settings/images/profile") @app.post("/settings/images/profile")
@ -568,15 +567,12 @@ def settings_delete_banner(v):
@auth_required @auth_required
def settings_blockedpage(v): def settings_blockedpage(v):
return render_template("settings_blocks.html", v=v)
return render_template("settings_blocks.html",
v=v)
@app.get("/settings/css") @app.get("/settings/css")
@auth_required @auth_required
def settings_css_get(v): def settings_css_get(v):
return render_template("settings_css.html", v=v) return render_template("settings_css.html", v=v)
@app.post("/settings/css") @app.post("/settings/css")
@ -628,7 +624,7 @@ def settings_block_user(v):
return {"error": f"You have already blocked @{user.username}."}, 409 return {"error": f"You have already blocked @{user.username}."}, 409
if user.id == NOTIFICATIONS_ACCOUNT: if user.id == NOTIFICATIONS_ACCOUNT:
return {"error": "You can't block @files."}, 409 return {"error": "You can't block this user."}, 409
new_block = UserBlock(user_id=v.id, new_block = UserBlock(user_id=v.id,
target_id=user.id, target_id=user.id,
@ -679,7 +675,6 @@ def settings_unblock_user(v):
@auth_required @auth_required
def settings_apps(v): def settings_apps(v):
return render_template("settings_apps.html", v=v) return render_template("settings_apps.html", v=v)
@ -688,9 +683,6 @@ def settings_apps(v):
@validate_formkey @validate_formkey
def settings_remove_discord(v): def settings_remove_discord(v):
#if v.admin_level>1:
# return render_template("settings_filters.html", v=v, error="Admins can't disconnect Discord.")
remove_user(v) remove_user(v)
v.discord_id=None v.discord_id=None
@ -704,7 +696,6 @@ def settings_remove_discord(v):
@auth_required @auth_required
def settings_content_get(v): def settings_content_get(v):
return render_template("settings_filters.html", v=v) return render_template("settings_filters.html", v=v)
@app.post("/settings/name_change") @app.post("/settings/name_change")
@ -766,6 +757,7 @@ def settings_song_change(v):
os.remove(f"/songs/{v.song}.mp3") os.remove(f"/songs/{v.song}.mp3")
v.song=None v.song=None
g.db.add(v) g.db.add(v)
g.db.commit()
return redirect("/settings/profile") return redirect("/settings/profile")
song = song.replace("https://music.youtube.com", "https://youtube.com") song = song.replace("https://music.youtube.com", "https://youtube.com")
@ -784,6 +776,7 @@ def settings_song_change(v):
if path.isfile(f'/songs/{id}.mp3'): if path.isfile(f'/songs/{id}.mp3'):
v.song=id v.song=id
g.db.add(v) g.db.add(v)
g.db.commit()
return redirect("/settings/profile") return redirect("/settings/profile")