Files
LEDMatrix/scripts/utils
Chuck 5b6137f5f4 fix: address five valid review findings; skip two
Fixed:
- march-madness/requirements.txt: Pillow>=10.3.0 (patches CVE-2024-28219;
  10.3.0 is the actual fix version — reviewer cited 12.2.0 but that risks
  breaking API changes without test coverage)
- wifi_monitor_daemon.py: add missing `import subprocess`; subprocess.run
  and CalledProcessError would NameError at runtime on the NM restart path
- wifi_manager.py: validate ap_idle_timeout_minutes before arithmetic —
  coerce to int, clamp 1–1440, fall back to 15 on bad config values
- wifi_manager.py: call _remove_nm_dnsmasq_captive_conf() on all three
  rollback paths in _enable_ap_mode_nmcli_hotspot() and in the top-level
  except block so stale dnsmasq drop-ins are never left behind
- api_v3.py: fix wrong_password prefix strip — removeprefix("wrong_password:")
  then lstrip() handles both "wrong_password: msg" and "wrong_password:msg"
- plugins_manager.js: add .catch() to loadInstalledPlugins().then() to
  surface failures instead of silently dropping unhandled rejections

Skipped:
- WiFiManager AP state persistence: architectural overhaul; _is_ap_mode_active()
  already derives from live system state, not in-memory variables
- Absolute subprocess paths in api_v3.py: paths vary by distro (/usr/bin vs
  /bin); web service has a normal PATH; sudoers already use resolved paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 12:27:41 -04:00
..
2025-12-27 14:15:49 -05:00
2025-12-27 14:15:49 -05:00
2025-12-27 14:15:49 -05:00
2025-12-27 14:15:49 -05:00

Utility Scripts

This directory contains utility scripts for maintenance and system operations.

Scripts

  • clear_cache.py - Clears LEDMatrix cache data (specific keys or all cache)
  • start_web_conditionally.py - Conditionally starts the web interface based on config settings
  • wifi_monitor_daemon.py - Background daemon that monitors WiFi/Ethernet connection and manages access point mode
  • cleanup_venv.sh - Cleans up Python virtual environment files
  • clear_python_cache.sh - Clears Python cache files (pycache, *.pyc, etc.)

Usage

Clear Cache

python3 scripts/utils/clear_cache.py --list          # List cache keys
python3 scripts/utils/clear_cache.py --clear-all      # Clear all cache
python3 scripts/utils/clear_cache.py --clear <key>    # Clear specific key

Start Web Interface Conditionally

This script is typically called by the systemd service (ledmatrix-web.service) and checks the web_display_autostart setting in config/config.json before starting the web interface.

WiFi Monitor Daemon

This daemon is typically run as a systemd service (ledmatrix-wifi-monitor.service) and automatically manages WiFi access point mode based on network connectivity.