fix(luci-app-crowdsec-dashboard): Prevent RPC timeout when CrowdSec not running

Added service status check in check_cscli() function to immediately return
an error instead of timing out when crowdsec service is not running.

This fixes the 'XHR request timed out' error in the dashboard when CrowdSec
is stopped.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-01-06 16:04:08 +01:00
parent fffe96999c
commit 4e98c03be4

View File

@ -15,12 +15,18 @@ secubox_log() {
CSCLI="/usr/bin/cscli"
# Check if cscli exists
# Check if cscli exists and crowdsec is running
check_cscli() {
if [ ! -x "$CSCLI" ]; then
echo '{"error": "cscli not found"}'
exit 1
fi
# Check if crowdsec service is running
if ! pgrep -x crowdsec >/dev/null 2>&1; then
echo '{"error": "crowdsec service not running"}'
exit 1
fi
}
# Get decisions list