* Update security metrics and risk score
(summary)
| 15606 | } catch (error) { |
| 15607 | console.error('Error checking for updates:', error); |
| 15608 | updateElement('update-status', 'Error'); |
| 15609 | const statusEl = document.getElementById('update-status'); |
| 15610 | if (statusEl) { |
| 15611 | statusEl.className = 'text-sm px-2 py-1 rounded bg-red-700 text-red-300'; |
| 15612 | } |
| 15613 | updateElement('update-info', 'Failed to check for updates'); |
| 15614 | addConsoleMessage(`Failed to check for updates: ${error.message}`, 'error'); |
| 15615 | // The check endpoint answers even when git is unhappy, so a thrown error |
| 15616 | // means the web app itself is unreachable - retrying is all we can do. |
| 15617 | const updateBtn = document.getElementById('update-btn'); |
| 15618 | if (updateBtn) { |
| 15619 | updateBtn.disabled = false; |
| 15620 | updateBtn.onclick = checkForUpdates; |
| 15621 | updateBtn.className = 'w-full bg-gray-600 hover:bg-gray-500 text-white py-2 px-4 rounded transition-colors'; |
| 15622 | updateElement('update-btn-text', 'Retry Check'); |
| 15623 | } |
| 15624 | } |
| 15625 | } |
| 15626 | |
| 15627 | async function fixGitConfig() { |
| 15628 | try { |
| 15629 | updateElement('update-btn-text', 'Fixing...'); |
| 15630 | const updateBtn = document.getElementById('update-btn'); |
| 15631 | updateBtn.disabled = true; |
| 15632 | |
| 15633 | addConsoleMessage('Fixing git configuration...', 'info'); |
| 15634 | |
| 15635 | const result = await postAPI('/api/system/fix-git', {}); |
| 15636 | |
| 15637 | if (result.success) { |
| 15638 | addConsoleMessage('Git configuration fixed successfully', 'success'); |
| 15639 | updateBtn.onclick = performUpdate; |
| 15640 | updateElement('update-btn-text', 'Update System'); |
| 15641 | setTimeout(() => { |
| 15642 | checkForUpdates(); |
| 15643 | }, 1000); |
| 15644 | } else { |
| 15645 | reportUpdateProblem('Failed to fix git configuration', result); |
| 15646 | updateBtn.disabled = false; |
| 15647 | updateElement('update-btn-text', 'Fix Git Config'); |
| 15648 | } |
| 15649 | |
| 15650 | } catch (error) { |
| 15651 | console.error('Error fixing git config:', error); |
| 15652 | addConsoleMessage(`Failed to fix git configuration: ${error.message}`, 'error'); |
| 15653 | const updateBtn = document.getElementById('update-btn'); |
| 15654 | updateBtn.disabled = false; |
| 15655 | updateElement('update-btn-text', 'Fix Git Config'); |
| 15656 | } |
| 15657 | } |
| 15658 | |
| 15659 | async function resolveGitConflicts() { |
no outgoing calls
no test coverage detected