diff --git a/files/routes/settings.py b/files/routes/settings.py index 5458303df..0a40ae22f 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -89,9 +89,19 @@ def upload_profile_background(v): os.remove(v.profile_background) v.profile_background = background g.db.add(v) - badge_grant(badge_id=193, user=v) + # badge_grant(badge_id=193, user=v) return redirect(f'/@{v.username}') +@app.delete('/settings/profile_background') +@limiter.limit(DEFAULT_RATELIMIT_SLOWER) +@auth_required +@ratelimit_user() +def delete_profile_background(v): + if v.profile_background: + os.remove(v.profile_background) + v.profile_background = None + return {"message": "Profile background removed!"} + @app.post("/settings/personal") @limiter.limit(DEFAULT_RATELIMIT_SLOWER) @auth_required diff --git a/files/templates/userpage/userpage.html b/files/templates/userpage/userpage.html index 57e7cb9b7..69a33a939 100644 --- a/files/templates/userpage/userpage.html +++ b/files/templates/userpage/userpage.html @@ -210,6 +210,15 @@ + + {% if v.profile_background -%} +
+ +
+ {%- endif %} {% endif %} {% if FEATURES['USERS_PROFILE_SONG'] and u.song and v and (v.id == u.id or v.mute and not u.unmutable) %} @@ -428,6 +437,15 @@ + + {% if v.profile_background -%} +
+ +
+ {%- endif %} {% endif %}