Commit Graph

10 Commits

Author SHA1 Message Date
9ce67f2da5 fix: Use correct UCI section types in SecuBox settings view (v0.6.0-r12)
- Changed form sections from type 'secubox' to match actual UCI config
- General/Dashboard/Module/Notification sections now use type 'core'
- Alert Thresholds section now uses type 'diagnostics'
- Security Settings section now uses type 'security'
- Advanced Settings section uses type 'core'
- Fixes "This section contains no values yet" errors

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-07 12:18:18 +01:00
b946279106 fix: Promise rendering in flows view addFooter
Fixed "[object Promise]" display bug in the flows view.

## Problem:
- Flows view was showing "[object Promise]" text on the page
- Root cause: The `addFooter()` function was returning a Promise
- LuCI calls `addFooter()` synchronously and expects it to return nothing or DOM elements
- When a Promise is returned, LuCI tries to render it as text, showing "[object Promise]"

## Solution:
Changed from:
```javascript
addFooter: function() {
    return Promise.all([...]).then(...);
}
```

To:
```javascript
addFooter: function() {
    Promise.all([...]).then(...);  // Execute but don't return
}
```

## Technical Details:
- The `addFooter()` hook is called after `render()` for post-render initialization
- It should perform async operations but not return promises
- The promise still executes and populates the containers correctly
- Only the return value was changed (removed the `return` keyword)

## Testing:
- Deployed to router
- Flows view now displays correctly without "[object Promise]"
- Initial data loading works properly
- Polling continues to update data

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 19:20:07 +01:00
f65bc8c4ca fix: Array nesting issue in devices and applications table rendering
Fixed "[object HTMLDivElement]" display bug in device and application list views.

## Problem:
- Device list showed "[object HTMLDivElement],[object HTMLDivElement],..." instead of table rows
- Applications list had the same issue
- Root cause: `sortedDevices.map()` and `sortedApps.map()` return arrays, but these arrays were being nested incorrectly in the E() children array

## Solution:
Changed table row structure from:
```javascript
E('div', { 'class': 'table' }, [
    E('div', { 'class': 'tr table-titles' }, [...]),  // header
    sortedDevices.map(function(device) {              // array nested wrong!
        return E('div', {...});
    })
])
```

To:
```javascript
E('div', { 'class': 'table' },
    [
        E('div', { 'class': 'tr table-titles' }, [...])  // header
    ].concat(
        sortedDevices.map(function(device) {             // properly flattened!
            return E('div', {...});
        })
    )
)
```

## Technical Details:
- The E() helper expects children to be individual DOM elements, not nested arrays
- Using `.concat()` properly flattens the array of row elements
- Applied fix to both devices.js and applications.js views

## Testing:
- Deployed to router
- Device list now displays all 6 detected devices with IP, MAC, traffic stats
- Applications list displays all 4 application categories correctly
- Table formatting and styling render properly

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 19:17:56 +01:00
ad234a001d feat: Comprehensive NetIfyd Dashboard Enhancements
Enhanced all NetIfyd LuCI views with improved UX, live status, and better data visualization following modern dashboard patterns.

## Flows View (flows.js) - Complete Rewrite:
- Redesigned from individual flow tracking to aggregated flow analytics
- Added 4 gradient metric cards: Total, Active, Expired, Purged flows
- New interface activity table showing TCP/UDP/ICMP packets per interface
- Protocol distribution section with visual progress bars and percentages
- Pause/Resume button for real-time updates
- Information panel explaining flow data limitations
- 3-second refresh interval for real-time monitoring

## Applications View (applications.js) - Enhanced:
- Added live service status badge (green "Live" / red "Offline")
- Implemented search filter for application names
- Reduced refresh interval from 10s to 5s for faster updates
- Improved header layout with better spacing
- Added visual feedback with loading states
- Color-coded application indicators with percentage bars

## Devices View (devices.js) - Enhanced:
- Added live service status badge matching applications view
- Implemented search filter for IP addresses and MAC addresses
- Reduced refresh interval from 10s to 5s
- Enhanced header with modern layout
- Better device list presentation with last-seen timestamps
- Traffic distribution visualization with upload/download bars

## Settings View (settings.js) - Enhanced:
- Added comprehensive configuration guide section
- Included recommended configuration best practices
- Added performance considerations and warnings
- Flow Export explanation for advanced users
- Links to external documentation (Netify.ai)
- Visual improvements to service status banner
- Better organized help information with icons

## Technical Improvements:
- All views handle empty data gracefully with informative messages
- Consistent modern UI design across all views
- Better error handling and user feedback
- Improved polling efficiency with proper container creation
- Responsive layouts that work on mobile devices

## Testing:
- Deployed and tested on OpenWrt 23.05 with NetIfyd 5.2.1
- Verified RPC backend compatibility
- Confirmed graceful degradation when flow export disabled
- Validated live status indicators and refresh mechanisms

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 19:07:35 +01:00
595bc5c06f feat: Enhanced live network statistics with interface breakdown
Dashboard Enhancements:

1. Real-Time Interface Statistics
   - Per-interface traffic monitoring (br-lan, br-wan)
   - TCP/UDP/ICMP packet breakdown with percentages
   - Total traffic and packet counts per interface
   - Visual progress bars showing protocol distribution
   - Dropped packet alerts when present
   - Auto-refreshing every 5 seconds

2. Improved Flow Display
   - Better flow status showing Active vs Expired counts
   - Enhanced "Network Flows" card subtitle format
   - Changed icon from exchange-alt to stream
   - Clearer separation of active/expired metrics

RPC Backend Changes:

3. Interface Stats in Dashboard API
   - Added "interfaces" object to get_dashboard response
   - Per-interface metrics: tcp_packets, udp_packets, icmp_packets
   - Traffic data: ip_bytes, wire_bytes
   - Quality metrics: capture_dropped packets
   - Dynamically discovers all monitored interfaces

4. Enhanced Flow Statistics
   - Added flows_active and flows_expired to stats object
   - More accurate flow state tracking
   - Better resource utilization metrics

UI/UX Improvements:

5. Live Interface Cards
   - Clean card-based design for each interface
   - Color-coded protocol stats (TCP=blue, UDP=green, ICMP=orange)
   - Responsive grid layout adapts to screen size
   - Real-time percentage calculations
   - Smooth transitions on data updates

6. Visual Hierarchy
   - Interface section positioned between overview stats and apps
   - Clear visual separation with border and padding
   - Consistent color scheme across dashboard
   - Better information density

Technical Details:
- Extracts interface list from netifyd status.json stats object
- Calculates protocol percentages client-side
- Uses grid layout for responsive display
- Leverages existing formatBytes utility
- No performance impact (lightweight rendering)

Benefits:
 See exactly which interface has traffic (LAN vs WAN)
 Understand protocol distribution per interface
 Quickly spot packet drops or issues
 Better network troubleshooting capabilities
 Real-time visibility into router traffic patterns

Example Output:
br-lan: 0 packets (LAN - local network)
br-wan: 85 TCP, 15 UDP, 13 ICMP = 113 total packets (WAN - internet)

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 18:53:23 +01:00
8ffd693a85 refactor: Remove debug features from NetIfyd dashboard
Removed Features:
- Debug mode toggle button
- Debug panel and log display
- Update indicator (count and time since last update)
- Debug logging functions (debug, toggleDebug)
- Debug state variables (debugMode, updateCount, errorCount, lastUpdate)
- REFRESH-DEBUG.md documentation

Preserved Features:
 Race condition fix (containers created before poll.add)
 Auto-refresh functionality (5-second polling)
 Data caching (latestDashboardData, latestTopApps, latestTopProtocols)
 Application aggregation function
 All core rendering functions
 Service control and statistics display

Benefits:
- Cleaner, production-ready code
- Reduced code complexity (~120 lines removed)
- Maintains all critical functionality
- Better performance (no debug overhead)

The dashboard now provides a streamlined interface focused on
displaying network intelligence data without development debug features.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 18:38:50 +01:00
8d5e4275f6 fix: CrowdSec CAPI registration and enable threat intelligence
CrowdSec Central API (CAPI) Fixed:
- Removed code that disabled online_client on install
- Added proper CAPI registration in crowdsec.defaults
- Registration now works (previous 403 errors were transient)
- Graceful fallback if CAPI registration fails

CAPI Features Now Working:
- Threat intelligence sharing enabled
- Pulling community blocklist (14,997+ IPs)
- Hub updates working without 403 errors
- SSH bruteforce: 12,388 bans from CAPI
- Generic scans: 1,176 bans from CAPI
- SSH exploits: 1,433 bans from CAPI

Registration Flow:
1. Create /etc/machine-id if missing
2. Register local API machine
3. Register with Central API (CAPI)
4. On CAPI failure, create minimal credentials file
5. Update hub index
6. Install default collections

Benefits of CAPI Integration:
- Real-time threat intelligence from global network
- Community-contributed IP blocklists
- Automatic updates for detection scenarios
- Signal sharing to help protect others
- Enhanced protection without manual IP list management

NetIfyd Dashboard Improvements:
- Added data caching for smoother updates
- Application aggregation function
- Fallback stats when data temporarily unavailable
- Better handling of undefined values

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 18:33:23 +01:00
5d847319e9 feat: Add comprehensive debug mode and fix refresh race condition
Dashboard Refresh Problem Fixed:
- Race condition where poll.add() was called before containers existed
- Containers were undefined during first poll callback
- DOM updates failed silently with no error logging
- Fixed by creating containers BEFORE setting up polling

Debug Features Added:
- Toggle debug mode with button in header
- Visual debug panel showing last 20 log entries
- Browser console logging with timestamps
- Live update indicator (count + time since last update)
- Error tracking and counting
- Detailed logging of all RPC calls and responses

Debug Panel Features:
- Timestamps for all events
- JSON data preview for API responses
- Auto-scroll with newest entries at top
- Max 20 entries to prevent memory issues
- Hidden by default, shown when debug enabled

Update Indicator:
- Shows "Updates: N | Last: Xs ago" in header
- Updates every second
- Visual feedback that polling is working
- Easy to spot stalled/broken polling

Error Handling:
- Try/catch around all poll callbacks
- Errors logged to debug panel and console
- Error counting for diagnostics
- Polling continues even after errors

Code Improvements:
- Proper container creation order
- Better error handling in load() and polling
- Debug logging throughout lifecycle
- Performance metrics tracking

Documentation:
- Complete analysis in REFRESH-DEBUG.md
- Troubleshooting guide
- Debug mode usage instructions
- Performance considerations

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 18:27:34 +01:00
e1c7c79104 feat: Enhanced netifyd metrics and fixed directory structure
Network Intelligence Dashboard Enhancements:
- Add detailed protocol breakdown (TCP/UDP/ICMP) with visual bars
- Display flow metrics (active, expired, purged)
- Show CPU and memory usage for netifyd process
- Add IP bytes vs wire bytes differentiation
- Enhanced stat cards with subtitles and better formatting

RPC Backend Improvements:
- Add tcp_packets, udp_packets, icmp_packets metrics
- Add ip_bytes (payload without ethernet overhead)
- Add flows_active, flows_expired, flows_purged counters
- Add cpu_usage and memory_kb from netifyd status
- Calculate CPU total from user + system time

Directory Structure Fix:
- Create /etc/netify.d/plugins.d on package install
- Create /etc/netify.d/address-groups.d
- Generate minimal netify-categories.json to prevent errors
- Auto-initialize UCI config for secubox-netifyd
- Auto-restart netifyd after directory creation

UCI Configuration:
- Settings: auto_refresh, socket configuration
- Analytics: limits for top apps/protocols/devices
- Data retention configuration

Issue Resolved:
- Netifyd was running but showing 0 flows due to missing directories
- Service now properly captures and analyzes network traffic
- All metrics displaying correctly in dashboard

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-06 18:18:35 +01:00
8fcd34abd0 feat: Netifyd Integration & Build System Improvements (v0.9.1)
Major updates:
- Replace luci-app-netifyd-dashboard with enhanced luci-app-secubox-netifyd
- Add netifyd 5.2.1 package with GCC 13.3/C++17 build fixes
- Fix nd-risks.cpp compilation errors via inline static maps patch
- Enhance local-build.sh with improved package building workflow
- Update secubox-core scripts version to v0.9.1

New Features:
- Complete netifyd dashboard with flows, devices, applications, and settings
- Local data collection with netifyd-collector
- Automated cron-based data aggregation
- RPCd integration for real-time statistics

Build Fixes:
- Patch 001: Fix C++17 inline static maps in nd-risks.hpp and nd-protos.hpp
- Patch 003: Skip ndpi tests to resolve roaring_v2 dependency issues
- Add libatomic dependency
- Include libnetifyd shared libraries in package

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-05 17:35:11 +01:00