Wuhp commited on
Commit ·
b701fde
1
Parent(s): b326094
Recheck interaction state after async poll before replacing open results
Browse files- app/index.html +4 -2
app/index.html
CHANGED
|
@@ -283,7 +283,9 @@ function keepReportStable(){
|
|
| 283 |
}
|
| 284 |
async function loadScans(force=false){try{
|
| 285 |
if(!force&&keepReportStable())return;
|
| 286 |
-
|
|
|
|
|
|
|
| 287 |
const hosts=[...new Set(findings.map(f=>{try{return new URL(f.url).hostname}catch{return ''}}).filter(Boolean))].sort();
|
| 288 |
const previous=el('findHost').value;
|
| 289 |
el('findHost').innerHTML='<option value="all">All hosts</option>'+hosts.map(host=>'<option value="'+esc(host)+'">'+esc(host)+'</option>').join('');
|
|
@@ -321,6 +323,6 @@ async function loadScans(force=false){try{
|
|
| 321 |
window.scrollTo({top:currentScroll,behavior:'instant'});
|
| 322 |
renderFindings();
|
| 323 |
}catch(e){message('Could not load jobs: '+e.message,true)}}
|
| 324 |
-
async function loadLogs(force=false){try{if(!force&&keepReportStable())return;const r=await api('/logs');el('fullLogs').textContent=JSON.stringify(r.events||[],null,2)}catch(e){message(e.message,true)}}
|
| 325 |
function copyLogs(){navigator.clipboard.writeText(el('fullLogs').textContent).then(()=>message('Logs copied.')).catch(e=>message(e.message,true))}
|
| 326 |
window.addEventListener('DOMContentLoaded',()=>{loadNucleiDefaults();refresh();setInterval(()=>{if(!autoRefreshPaused){loadScans();if(currentTab==='logs')loadLogs()}},3000)});</script></body></html>
|
|
|
|
| 283 |
}
|
| 284 |
async function loadScans(force=false){try{
|
| 285 |
if(!force&&keepReportStable())return;
|
| 286 |
+
const latestJobs=await api('/scans');
|
| 287 |
+
if(!force&&keepReportStable())return; // Interaction may begin during the request.
|
| 288 |
+
scanJobs=latestJobs;findings=flattenJobs();
|
| 289 |
const hosts=[...new Set(findings.map(f=>{try{return new URL(f.url).hostname}catch{return ''}}).filter(Boolean))].sort();
|
| 290 |
const previous=el('findHost').value;
|
| 291 |
el('findHost').innerHTML='<option value="all">All hosts</option>'+hosts.map(host=>'<option value="'+esc(host)+'">'+esc(host)+'</option>').join('');
|
|
|
|
| 323 |
window.scrollTo({top:currentScroll,behavior:'instant'});
|
| 324 |
renderFindings();
|
| 325 |
}catch(e){message('Could not load jobs: '+e.message,true)}}
|
| 326 |
+
async function loadLogs(force=false){try{if(!force&&keepReportStable())return;const r=await api('/logs');if(!force&&keepReportStable())return;el('fullLogs').textContent=JSON.stringify(r.events||[],null,2)}catch(e){message(e.message,true)}}
|
| 327 |
function copyLogs(){navigator.clipboard.writeText(el('fullLogs').textContent).then(()=>message('Logs copied.')).catch(e=>message(e.message,true))}
|
| 328 |
window.addEventListener('DOMContentLoaded',()=>{loadNucleiDefaults();refresh();setInterval(()=>{if(!autoRefreshPaused){loadScans();if(currentTab==='logs')loadLogs()}},3000)});</script></body></html>
|