- Debounce MutationObserver (200ms) and scope to #modelGrid when available
- Sanitize data.updated via parseInt before innerHTML to prevent XSS
- Guard pagination against page_size=0 (division by zero) and negative values
- Reject non-POST requests on /api/lm-extra/fetch-stats (state-mutating)
- Early return in upsert_batch for empty rows list
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add /api/lm-extra/fetch-stats (POST) endpoint that bulk-fetches CivitAI
stats for all remote models and stores them in the local stats DB with
optional WebSocket progress broadcasting
- Add /api/lm-extra/stats-status (GET) endpoint to check DB population
- Add /lm-extra/stats-ui.js handler that serves the client-side JS file
- Create static/lm_stats_ui.js: intercepts list API responses to capture
stats, patches model cards with download/rating/likes badges, adds
CivitAI Stats sort options to the dropdown, and adds a Fetch Stats
toolbar button
- Inject stats-ui.js script tag into proxied HTML page responses
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>