Fix update checker to force fresh check on button click
This commit is contained in:
1 parent
710e91a3a8
commit
0f75258405
2 files changed
+15
-1
No files matched your search
@@ -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,
|
||||
})
|
||||
+1
-1
@@ -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';
|
||||
|
||||
Reference in new issue
Block a user