- Add SecuBox dark theme initialization to all views (dashboard, alerts,
clients, services, history)
- Fix flow count detection by using jsonfilter instead of jq (OpenWrt native)
- Prioritize /var/run/netifyd/status.json for ndpid-compat flow data
- Remove filtering expect{} from API.getActiveStreams() RPC declaration
- Update CLAUDE.md with jsonfilter usage guidelines for OpenWrt
The dashboard now correctly displays:
- Total Flows count from nDPId via ndpid-compat
- nDPId/Netifyd status indicators
- SecuBox dark theme with portal header
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1.6 KiB
1.6 KiB
Claude Instructions for SecuBox OpenWrt
OpenWrt Shell Scripting Guidelines
Process Detection
- Use
pgrep crowdsecinstead ofpgrep -x crowdsec- The
-xflag requires an exact process name match which doesn't work reliably on OpenWrt/BusyBox - Same applies to other daemons: use
pgrep <name>without-x
- The
Command Availability
timeoutcommand is NOT available on OpenWrt by default - use alternatives or check withcommand -v timeoutsscommand may not be available - usenetstator/proc/net/tcpas fallbackssqlite3may not be installed - provide fallback methods (e.g., delete database file instead of running SQL)
JSON Parsing
- Use
jsonfilterinstead ofjq- jsonfilter is native to OpenWrt (part of libubox), jq is often not installed - Syntax examples:
# Get a field value jsonfilter -i /path/to/file.json -e '@.field_name' # Get nested field jsonfilter -i /path/to/file.json -e '@.parent.child' # Get array length (count elements) jsonfilter -i /path/to/file.json -e '@[*]' | wc -l # Get array element jsonfilter -i /path/to/file.json -e '@[0]' - Always check for empty results:
[ -z "$result" ] && result=0
Port Detection
When checking if a port is listening, use this order of fallbacks:
/proc/net/tcp(always available) - ports are in hex (e.g., 8080 = 1F90)netstat -tln(usually available)ss -tln(may not be available)
Logging
- OpenWrt uses
logreadinstead of traditional log files - Use
logread -l Nto get last N lines - CrowdSec writes to
/var/log/crowdsec.log