mirror of
https://github.com/smittix/intercept.git
synced 2026-04-24 06:40:00 -07:00
Fix TSCM sweep module variable scoping and remove stale progress bar call
- Access module-level _sweep_running, _current_sweep_id, and tscm_queue via explicit package import to avoid UnboundLocalError from closure variable shadowing in route handlers - Remove orphaned tscmProgressBar.style.width assignment in index.html Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,8 @@ logger = logging.getLogger('intercept.tscm')
|
|||||||
@tscm_bp.route('/status')
|
@tscm_bp.route('/status')
|
||||||
def tscm_status():
|
def tscm_status():
|
||||||
"""Check if any TSCM operation is currently running."""
|
"""Check if any TSCM operation is currently running."""
|
||||||
return jsonify({'running': _sweep_running})
|
import routes.tscm as _tscm_pkg
|
||||||
|
return jsonify({'running': _tscm_pkg._sweep_running})
|
||||||
|
|
||||||
|
|
||||||
@tscm_bp.route('/sweep/start', methods=['POST'])
|
@tscm_bp.route('/sweep/start', methods=['POST'])
|
||||||
@@ -95,14 +96,15 @@ def stop_sweep():
|
|||||||
@tscm_bp.route('/sweep/status')
|
@tscm_bp.route('/sweep/status')
|
||||||
def sweep_status():
|
def sweep_status():
|
||||||
"""Get current sweep status."""
|
"""Get current sweep status."""
|
||||||
|
import routes.tscm as _tscm_pkg
|
||||||
|
|
||||||
status = {
|
status = {
|
||||||
'running': _sweep_running,
|
'running': _tscm_pkg._sweep_running,
|
||||||
'sweep_id': _current_sweep_id,
|
'sweep_id': _tscm_pkg._current_sweep_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if _current_sweep_id:
|
if _tscm_pkg._current_sweep_id:
|
||||||
sweep = get_tscm_sweep(_current_sweep_id)
|
sweep = get_tscm_sweep(_tscm_pkg._current_sweep_id)
|
||||||
if sweep:
|
if sweep:
|
||||||
status['sweep'] = sweep
|
status['sweep'] = sweep
|
||||||
|
|
||||||
@@ -113,12 +115,14 @@ def sweep_status():
|
|||||||
def sweep_stream():
|
def sweep_stream():
|
||||||
"""SSE stream for real-time sweep updates."""
|
"""SSE stream for real-time sweep updates."""
|
||||||
|
|
||||||
|
import routes.tscm as _tscm_pkg
|
||||||
|
|
||||||
def _on_msg(msg: dict[str, Any]) -> None:
|
def _on_msg(msg: dict[str, Any]) -> None:
|
||||||
process_event('tscm', msg, msg.get('type'))
|
process_event('tscm', msg, msg.get('type'))
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
sse_stream_fanout(
|
sse_stream_fanout(
|
||||||
source_queue=tscm_queue,
|
source_queue=_tscm_pkg.tscm_queue,
|
||||||
channel_key='tscm',
|
channel_key='tscm',
|
||||||
timeout=1.0,
|
timeout=1.0,
|
||||||
keepalive_interval=30.0,
|
keepalive_interval=30.0,
|
||||||
|
|||||||
@@ -14740,7 +14740,6 @@
|
|||||||
document.getElementById('tscmProgress').style.display = 'none';
|
document.getElementById('tscmProgress').style.display = 'none';
|
||||||
document.getElementById('tscmProgressLabel').textContent = 'Sweep Complete';
|
document.getElementById('tscmProgressLabel').textContent = 'Sweep Complete';
|
||||||
document.getElementById('tscmProgressPercent').textContent = '100%';
|
document.getElementById('tscmProgressPercent').textContent = '100%';
|
||||||
document.getElementById('tscmProgressBar').style.width = '100%';
|
|
||||||
|
|
||||||
// Final update of counts
|
// Final update of counts
|
||||||
updateTscmThreatCounts();
|
updateTscmThreatCounts();
|
||||||
|
|||||||
Reference in New Issue
Block a user