MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / triggerManualVulnScan

Function triggerManualVulnScan

web/scripts/ragnar_modern.js:14844–14894  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14842
14843 const finish = (message, level, info) => {
14844 addConsoleMessage(message, level);
14845 updateElement('update-info', info);
14846 const updateBtn = document.getElementById('update-btn');
14847 if (updateBtn) {
14848 updateBtn.disabled = false;
14849 updateBtn.onclick = performUpdate;
14850 updateBtn.className = 'w-full bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded transition-colors';
14851 updateElement('update-btn-text', 'Update System');
14852 }
14853 setTimeout(() => checkForUpdates(), 3000);
14854 };
14855
14856 const checkService = async () => {
14857 attempts++;
14858 try {
14859 const response = await networkAwareFetch('/api/system/update-status', { method: 'GET' });
14860 if (!response.ok) {
14861 throw new Error(`HTTP ${response.status}`);
14862 }
14863 const status = await response.json();
14864 const post = status.post_update || {};
14865
14866 if (startedAt === null) {
14867 startedAt = status.service_started || 0;
14868 } else if (status.service_started && status.service_started !== startedAt) {
14869 sawRestart = true;
14870 }
14871
14872 if (post.step && post.step !== lastStep) {
14873 lastStep = post.step;
14874 addConsoleMessage(`Post-update: ${post.step}`, 'info');
14875 updateElement('update-info', `Finishing update: ${post.step}...`);
14876 // Real progress buys more time, up to the hard ceiling.
14877 maxAttempts = Math.min(hardCeiling, attempts + 60);
14878 }
14879 if (post.stale) {
14880 addConsoleMessage('A previous post-update run never finished - ignoring its status. '
14881 + 'See data/logs/post_update.log.', 'warning');
14882 }
14883
14884 const commitMatches = !expectedCommit ||
14885 (status.commit && status.commit.startsWith(expectedCommit.slice(0, 8)));
14886 const postDone = !post.state || post.state === 'finished';
14887
14888 if (commitMatches && postDone && sawRestart) {
14889 if (post.outcome === 'failed') {
14890 finish(`⚠️ Update applied, but some post-update steps failed: ${post.failures || 'see data/logs/post_update.log'}`,
14891 'warning', 'Update applied with warnings. Check the log.');
14892 } else {
14893 finish('✅ Update verified - the box is running the new version.', 'success',
14894 'Update completed successfully. Service is online.');
14895 }
14896 return;
14897 }

Callers

nothing calls this directly

Calls 5

errorMethod · 0.80
addConsoleMessageFunction · 0.70
fetchAPIFunction · 0.70
showNotificationFunction · 0.70
loadThreatIntelDataFunction · 0.70

Tested by

no test coverage detected