Fix Update button to git pull and refresh UI

This commit is contained in:
2026-01-01 18:50:09 +11:00
parent 5333f924ac
commit d9faee1114
2 changed files with 57 additions and 7 deletions

View File

@@ -398,8 +398,13 @@
<script>
// Additional inline functions
async function updateScanner() {
if (!confirm('Update UltyScan? This may take a while.')) return;
showNotification('Starting update...', 'info');
if (!confirm('Update UltyScan to latest version from GitHub?')) return;
const btn = event.target;
btn.disabled = true;
btn.textContent = 'Updating...';
showNotification('Pulling latest changes from GitHub...', 'info');
try {
const response = await fetch('execute.php', {
method: 'POST',
@@ -410,10 +415,17 @@
});
const result = await response.json();
if (result.success) {
showNotification('Update started. Check console for progress.', 'success');
showNotification('Updated to commit #' + result.commit + '. Refreshing page...', 'success');
setTimeout(() => window.location.reload(), 2000);
} else {
showNotification('Update failed: ' + (result.error || 'Unknown error'), 'error');
btn.disabled = false;
btn.textContent = 'Update UltyScan';
}
} catch (e) {
showNotification('Update failed.', 'error');
showNotification('Update failed: ' + e.message, 'error');
btn.disabled = false;
btn.textContent = 'Update UltyScan';
}
}