Compare commits

..

No commits in common. "11dbffcf49e8f5d26f0abce0ef120314b8cdff8c" and "780b7f9287a27612296721de2f266394f93d0797" have entirely different histories.

3 changed files with 11 additions and 9 deletions

View File

@ -1,5 +1,5 @@
[tool.bumpversion] [tool.bumpversion]
current_version = "1.4.20" current_version = "1.4.19"
commit = true commit = true
tag = true tag = true
tag_name = "{new_version}" tag_name = "{new_version}"

View File

@ -1 +1 @@
1.4.20 1.4.19

16
app.py
View File

@ -74,9 +74,6 @@ def make_cache_key(*args, **kwargs):
"""Generate a cache key based on the user's session and request path.""" """Generate a cache key based on the user's session and request path."""
username = session.get('username', 'anonymous') username = session.get('username', 'anonymous')
path = request.path path = request.path
# Include query string in cache key to bust cache with version parameter
if request.query_string:
return f"view/{username}/{path}?{request.query_string.decode()}"
return f"view/{username}/{path}" return f"view/{username}/{path}"
@app.before_request @app.before_request
@ -301,13 +298,18 @@ def delete_account() -> Response:
account_id = request.form.get("id") account_id = request.form.get("id")
base_url = app.config["BACKEND_URL"] base_url = app.config["BACKEND_URL"]
delete_user_account(base_url, session["auth_credentials"], account_id) delete_user_account(base_url, session["auth_credentials"], account_id)
# Clear cache for user accounts route
cache_key = f"view/{session['username']}/accounts"
cache.delete(cache_key)
# Also clear memoized version for good measure
cache.delete_memoized(user_accounts, key_prefix=make_cache_key)
# Clear home page cache as well since it shows account stats
cache_key_home = f"view/{session['username']}/home"
cache.delete(cache_key_home)
# Run the NPM config update in a background thread to remove the deleted account's redirect # Run the NPM config update in a background thread to remove the deleted account's redirect
thread = threading.Thread(target=_update_npm_config_in_background, args=(session["auth_credentials"],)) thread = threading.Thread(target=_update_npm_config_in_background, args=(session["auth_credentials"],))
thread.start() thread.start()
# Redirect with a version nonce to bust all caches return redirect(url_for("user_accounts"))
import time
nonce = int(time.time())
return redirect(f"{url_for('user_accounts')}?_v={nonce}")
@app.route("/validateAccount", methods=["POST"]) @app.route("/validateAccount", methods=["POST"])
def validate_account() -> Tuple[Response, int]: def validate_account() -> Tuple[Response, int]: