mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 21:03:01 +00:00
Reviewed all 12 CodeRabbit comments on PR #306, verified each against the current code, and fixed the 11 valid ones. The 12th finding is a real code bug (cache_manager.delete() calls in api_helper.py and resource_monitor.py) that's already in the planned follow-up code-fix PR, so it stays out of this docs PR. Fixed: .cursor/plugins_guide.md, .cursor/README.md, .cursorrules - I claimed "there is no --emulator flag" in 3 places. Verified in run.py:19-20 that the -e/--emulator flag is defined and functional (it sets os.environ["EMULATOR"]="true" before the display imports). Other docs I didn't touch (.cursor/plugin_templates/QUICK_START.md, docs/PLUGIN_DEVELOPMENT_GUIDE.md) already use the flag correctly. Replaced all 3 wrong statements with accurate guidance that both forms work and explains the CLI flag's relationship to the env var. .cursorrules, docs/GETTING_STARTED.md, docs/WEB_INTERFACE_GUIDE.md, docs/PLUGIN_DEVELOPMENT_GUIDE.md - Four places claimed "the plugin loader also falls back to plugins/". Verified that PluginManager.discover_plugins() (src/plugin_system/plugin_manager.py:154) only scans the configured directory — no fallback. The fallback to plugins/ exists only in two narrower places: store_manager.py:1700-1718 (store install/update/uninstall operations) and schema_manager.py:70-80 (schema lookup for the web UI form generator). Rewrote all four mentions with the precise scope. Added a recommendation to set plugin_system.plugins_directory to "plugins" for the smoothest dev workflow with dev_plugin_setup.sh symlinks. docs/FONT_MANAGER.md - The "Status" warning told plugin authors to use display_manager.font_manager.resolve_font(...) as a workaround for loading plugin fonts. Verified in src/font_manager.py that resolve_font() takes a family name, not a file path — so the workaround as written doesn't actually work. Rewrote to tell authors to load the font directly with PIL or freetype-py in their plugin. - The same section said "the user-facing font override system in the Fonts tab still works for any element that's been registered via register_manager_font()". Verified in web_interface/blueprints/api_v3.py:5404-5428 that /api/v3/fonts/overrides is a placeholder implementation that returns empty arrays and contains "would integrate with the actual font system" comments — the Fonts tab does not have functional integration with register_manager_font() or the override system. Removed the false claim and added an explicit note that the tab is a placeholder. docs/ADVANCED_FEATURES.md:523 - The on-demand section said REST/UI calls write a request "into the cache manager (display_on_demand_config key)". Wrong — verified via grep that api_v3.py:1622 and :1687 write to display_on_demand_request, and display_on_demand_config is only written by the controller during activation (display_controller.py:1195, cleared at :1221). Corrected the key name and added controller file:line references so future readers can verify. docs/ADVANCED_FEATURES.md:803 - "Plugins using the background service" paragraph listed all scoreboard plugins but an orphaned "⏳ MLB (baseball)" bullet remained below from the old version of the section. Removed the orphan and added "baseball/MLB" to the inline list for clarity. web_interface/README.md - The POST /api/v3/system/action action list was incomplete. Verified in web_interface/app.py:1383,1386 that enable_autostart and disable_autostart are valid actions. Added both. - The Plugin Store section was missing GET /api/v3/plugins/store/github-status (verified at api_v3.py:3296). Added it. - The SSE line-range reference was app.py:607-615 but line 619 contains the "Exempt SSE streams from CSRF and add rate limiting" block that's semantically part of the same feature. Extended the range to 607-619. docs/GETTING_STARTED.md - Rows/Columns step said "Columns: 64 or 96 (match your hardware)". The web UI's validation accepts any integer in 16-128. Clarified that 64 and 96 are the common bundled-hardware values but the valid range is wider. Not addressed (out of scope for docs PR): - .cursorrules:184 CodeRabbit comment flagged the non-existent cache_manager.delete() calls in src/common/api_helper.py:287 and src/plugin_system/resource_monitor.py:343. These are real CODE bugs, not doc bugs, and they're the first item in the planned post-docs-refresh code-cleanup PR (see /home/chuck/.claude/plans/warm-imagining-river.md). The docs in this PR correctly state that delete() doesn't exist on CacheManager — the fix belongs in the follow-up code PR that either adds a delete() shim or updates the two callers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
134 lines
4.5 KiB
Markdown
134 lines
4.5 KiB
Markdown
# LED Matrix Web Interface V3
|
|
|
|
Modern, production web interface for controlling the LED Matrix display.
|
|
|
|
## Overview
|
|
|
|
This directory contains the active V3 web interface with the following features:
|
|
- Real-time display preview via Server-Sent Events (SSE)
|
|
- Plugin management and configuration
|
|
- System monitoring and logs
|
|
- Modern, responsive UI
|
|
- RESTful API
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
web_interface/
|
|
├── app.py # Main Flask application
|
|
├── start.py # Startup script
|
|
├── run.sh # Shell runner script
|
|
├── requirements.txt # Python dependencies
|
|
├── blueprints/ # Flask blueprints
|
|
│ ├── api_v3.py # API endpoints
|
|
│ └── pages_v3.py # Page routes
|
|
├── templates/ # HTML templates
|
|
│ └── v3/
|
|
│ ├── base.html
|
|
│ ├── index.html
|
|
│ └── partials/
|
|
└── static/ # CSS/JS assets
|
|
└── v3/
|
|
├── app.css
|
|
└── app.js
|
|
```
|
|
|
|
## Running the Web Interface
|
|
|
|
### Standalone (Development)
|
|
|
|
From the project root:
|
|
```bash
|
|
python3 web_interface/start.py
|
|
```
|
|
|
|
Or using the shell script:
|
|
```bash
|
|
./web_interface/run.sh
|
|
```
|
|
|
|
### As a Service (Production)
|
|
|
|
The web interface can run as a systemd service that starts automatically based on the `web_display_autostart` configuration setting:
|
|
|
|
```bash
|
|
sudo systemctl start ledmatrix-web
|
|
sudo systemctl enable ledmatrix-web # Start on boot
|
|
```
|
|
|
|
## Accessing the Interface
|
|
|
|
Once running, access the web interface at:
|
|
- Local: http://localhost:5000
|
|
- Network: http://<raspberry-pi-ip>:5000
|
|
|
|
## Configuration
|
|
|
|
The web interface reads configuration from:
|
|
- `config/config.json` - Main configuration
|
|
- `config/config_secrets.json` - API keys and secrets
|
|
|
|
## API Documentation
|
|
|
|
The V3 API is mounted at `/api/v3/` (`app.py:144`). For the complete
|
|
list and request/response formats, see
|
|
[`docs/REST_API_REFERENCE.md`](../docs/REST_API_REFERENCE.md). Quick
|
|
reference for the most common endpoints:
|
|
|
|
### Configuration
|
|
- `GET /api/v3/config/main` - Get main configuration
|
|
- `POST /api/v3/config/main` - Save main configuration
|
|
- `GET /api/v3/config/secrets` - Get secrets configuration
|
|
- `POST /api/v3/config/raw/main` - Save raw main config (Config Editor)
|
|
- `POST /api/v3/config/raw/secrets` - Save raw secrets
|
|
|
|
### Display & System Control
|
|
- `GET /api/v3/system/status` - System status
|
|
- `POST /api/v3/system/action` - Control display (action body:
|
|
`start_display`, `stop_display`, `restart_display_service`,
|
|
`restart_web_service`, `git_pull`, `reboot_system`, `shutdown_system`,
|
|
`enable_autostart`, `disable_autostart`)
|
|
- `GET /api/v3/display/current` - Current display frame
|
|
- `GET /api/v3/display/on-demand/status` - On-demand status
|
|
- `POST /api/v3/display/on-demand/start` - Trigger on-demand display
|
|
- `POST /api/v3/display/on-demand/stop` - Clear on-demand
|
|
|
|
### Plugins
|
|
- `GET /api/v3/plugins/installed` - List installed plugins
|
|
- `GET /api/v3/plugins/config?plugin_id=<id>` - Get plugin config
|
|
- `POST /api/v3/plugins/config` - Update plugin configuration
|
|
- `GET /api/v3/plugins/schema?plugin_id=<id>` - Get plugin schema
|
|
- `POST /api/v3/plugins/toggle` - Enable/disable plugin
|
|
- `POST /api/v3/plugins/install` - Install from registry
|
|
- `POST /api/v3/plugins/install-from-url` - Install from GitHub URL
|
|
- `POST /api/v3/plugins/uninstall` - Uninstall plugin
|
|
- `POST /api/v3/plugins/update` - Update plugin
|
|
|
|
### Plugin Store
|
|
- `GET /api/v3/plugins/store/list` - List available registry plugins
|
|
- `GET /api/v3/plugins/store/github-status` - GitHub authentication status
|
|
- `POST /api/v3/plugins/store/refresh` - Refresh registry from GitHub
|
|
|
|
### Real-time Streams (SSE)
|
|
SSE stream endpoints are defined directly on the Flask app
|
|
(`app.py:607-619` — includes the CSRF exemption and rate-limit hookup
|
|
alongside the three route definitions), not on the api_v3 blueprint:
|
|
- `GET /api/v3/stream/stats` - System statistics stream
|
|
- `GET /api/v3/stream/display` - Display preview stream
|
|
- `GET /api/v3/stream/logs` - Service logs stream
|
|
|
|
## Development
|
|
|
|
When making changes to the web interface:
|
|
|
|
1. Edit files in this directory
|
|
2. Test changes by running `python3 web_interface/start.py`
|
|
3. Restart the service if running: `sudo systemctl restart ledmatrix-web`
|
|
|
|
## Notes
|
|
|
|
- Templates and static files use the `v3/` prefix to allow for future versions
|
|
- The interface uses Flask blueprints for modular organization
|
|
- SSE streams provide real-time updates without polling
|
|
|