From 0f75258405d573bc88ac09a2493edb7104cd1579 Mon Sep 17 00:00:00 2001 From: Reditus Date: Tue, 12 May 2026 03:51:25 +0100 Subject: [PATCH] Fix update checker to force fresh check on button click --- app/routes/api.py | 14 ++++++++++++++ templates/base.html | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/routes/api.py b/app/routes/api.py index 5df0cbc..ce287c9 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -726,3 +726,17 @@ def register_api_routes(app, services, settings): updater._update_available = True return jsonify({'success': True, 'message': 'Update banner triggered'}) return jsonify({'success': False, 'error': 'Updater not available'}) + + @app.route('/api/update/check', methods=['POST']) + def api_update_check(): + """Force a fresh check against GitHub.""" + updater = services.get('updater') + if not updater: + return jsonify({'success': False, 'error': 'Updater not available'}) + updater.check_for_updates() + return jsonify({ + 'available': updater.update_available, + 'status': updater.update_status, + 'local_sha': updater._current_sha, + 'remote_sha': updater._latest_sha, + }) diff --git a/templates/base.html b/templates/base.html index 378deeb..438e1c4 100644 --- a/templates/base.html +++ b/templates/base.html @@ -57,7 +57,7 @@ btn.textContent = 'Checking...'; btn.disabled = true; try { - const resp = await fetch('/api/update/status'); + const resp = await fetch('/api/update/check', { method: 'POST' }); const data = await resp.json(); if (data.available) { document.getElementById('update-banner').style.display = 'flex';