Commit Graph

9 Commits

Author SHA1 Message Date
9b9becd0a8 navbar 2025-12-29 09:03:49 +01:00
4406825611 feat: Implement core features for network-modes and system-hub
Network Modes (+536 lines RPCD):
- Enhanced router.js with improved proxy configuration
- Expanded RPCD backend with new methods
- Updated README with feature documentation

System Hub (+511 lines RPCD, +127 lines API):
- Implemented diagnostics collection features
- Enhanced remote management interface
- Expanded RPCD backend with new RPC methods
- Added new API methods for diagnostics and remote access

Total changes: +1,392 additions, -126 deletions

Preparation for v0.3.6 release with real feature implementations
from CODEX roadmaps.
2025-12-28 15:34:23 +01:00
fadf606f31 feat(system-hub): enhance dynamic overview stats for v0.3.2
- Add network throughput stats (RX/TX total bytes)
- Add process count display (running/total)
- Add swap usage information
- Add dynamic status indicators (✓, , ⚠️) with pulse animation
- Add detailed tooltips with absolute values
- Add detail text under each stat card
- Enhance stats grid layout for 5 cards
- Update version from 0.3.1 to 0.3.2

Backend enhancements:
- Extract process count from /proc/loadavg
- Calculate swap usage from /proc/meminfo
- Aggregate network throughput from all interfaces

Frontend enhancements:
- Display process count alongside CPU load
- Show swap usage when available
- Display total RX/TX in GB
- Add pulsing status icons
- Show contextual details (MB/GB values, process count, load average)

CSS improvements:
- Add .sh-stat-status-icon with subtle pulse animation
- Add .sh-stat-overview-detail for contextual information
- Add network gradient color scheme
- Adjust grid for better 5-card layout
2025-12-28 02:47:35 +01:00
e90cf85f69 feat: implement working system logs viewer in system-hub
Fixed and enhanced the system logs functionality with real-time log viewing
and color-coded log levels.

🔧 Backend Fix (RPCD)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Problem:
- get_logs() function returned empty array
- Logs were piped through while loop creating a subshell
- json_add_string in subshell didn't affect main JSON output

Solution:
- Use temporary file to collect logs
- Read from file outside of subshell
- Properly build JSON array with all log lines

Implementation:
```sh
# Store logs in temporary file
logread | tail -n "$lines" > "$tmpfile"

# Read from file (no subshell issue)
while IFS= read -r line; do
    json_add_string "" "$line"
done < "$tmpfile"
```

Testing:
 ubus call luci.system-hub get_logs '{"lines": 100}' → Returns real logs
 Filter parameter works: get_logs '{"filter": "error"}'
 Temporary files cleaned up after use

🎨 Frontend Enhancement (logs.js)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Added color-coded log level display:

Features:
1. **Color-coded by severity:**
   - 🔴 Errors (red): error, err, fatal, crit
   - 🟡 Warnings (orange): warn, warning
   - 🔵 Info (blue): info, notice
   - 🟣 Debug (purple): debug
   - 🟢 Success (green): success, ok

2. **Visual enhancements:**
   - Colored left border for each log line
   - Semi-transparent background matching log level
   - JetBrains Mono font for better readability
   - Proper line spacing and padding

3. **Empty state:**
   - Friendly message when no logs available
   - Different message for empty search results
   - Large icon for better UX

Implementation:
```javascript
renderLogLine: function(line) {
    // Detect log level from keywords
    if (line.includes('error')) {
        color = '#ef4444';  // Red
        bgColor = 'rgba(239, 68, 68, 0.1)';
    }
    // ... other levels

    return E('div', {
        'style': 'border-left: 3px solid ' + color + '; ...'
    }, line);
}
```

📋 Features Summary
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

 Real-time system log viewing (logread integration)
 Filter by log level (all, errors, warnings, info)
 Search functionality (filter text in logs)
 Adjustable line count (50, 100, 200, 500, 1000 lines)
 Color-coded log levels for easy identification
 Refresh button to reload logs
 Download logs as .txt file
 Statistics: total lines, errors count, warnings count
 Beautiful empty state when no logs match

🚀 Deployment
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

 Updated RPCD backend on router
 Updated frontend logs.js on router
 Permissions fixed (755 for RPCD, 644 for JS)
 Services restarted (rpcd, uhttpd)
 Tested and working

Test URL: https://192.168.8.191/cgi-bin/luci/admin/secubox/system/system-hub/logs

Files Modified:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Backend:
* luci-app-system-hub/root/usr/libexec/rpcd/luci.system-hub
  - Fixed get_logs() to return real logs (+12 lines refactor)

Frontend:
* luci-app-system-hub/htdocs/luci-static/resources/view/system-hub/logs.js
  - Added renderLogLine() for color-coded display (+27 lines)
  - Enhanced updateLogDisplay() with empty state (+18 lines)
  - JetBrains Mono font integration

🎯 User Experience
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Before:
 Empty log viewer (backend returned [])
 Plain text display
 No visual distinction between log levels

After:
 Real system logs displayed
 Color-coded by severity level
 Easy to spot errors and warnings
 Professional terminal-like appearance
 Fully functional filters and search

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 21:07:16 +01:00
915ce641f4 fix: system-hub get_components - Use correct ubus method names
Fixed get_components() to call luci.secubox 'modules' instead of 'get_modules'
Fixed get_components_by_category() to call 'modules_by_category' instead of 'get_modules_by_category'

This resolves the "No related RPC reply" error in System Hub overview.

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 17:09:09 +01:00
801601591c release: v0.1.2-alpha - Dynamic Module Detection & Responsive Cards
Major Features:
• SecuBox v0.1.2: Real-time module auto-detection via opkg
• System Hub: Dynamic component detection leveraging SecuBox
• Responsive card grid layout for modules and components
• Category filtering tabs (All/Security/Monitoring/Network/System)
• Auto-refresh every 30 seconds with real-time status

SecuBox Changes:
• Added detect_real_modules() function to scan opkg for installed packages
• Enhanced get_modules() with dual-source detection (UCI + auto-detected)
• Enhanced get_modules_by_category() with same dual-source logic
• Auto-categorization based on package name patterns
• Real version detection from opkg for installed packages
• Added in_uci flag to distinguish module sources
• Responsive modules.js with card-based layout
• New modules.css with theme support and animations

System Hub Changes:
• Added get_components() and get_components_by_category() to RPCD
• Components leverage SecuBox module detection via ubus
• Completely rewritten components.js with responsive cards
• New components.css matching SecuBox design language
• Extended API with getComponents() methods
• Unified component management with quick actions

Deployment:
• Added deploy-secubox-v0.1.2.sh for SecuBox deployment
• Added deploy-system-hub-dynamic.sh for System Hub deployment
• Added deploy-dynamic-modules.sh for combined deployment

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 17:06:00 +01:00
5902ac500a release: v0.1.1 - Unified Theme System with Dark/Light Mode Support
Major Features:
• Centralized theme system across SecuBox and System Hub
• Three theme modes: dark (default), light, and system (auto-detect)
• Single theme setting in SecuBox controls both plugins
• Real-time theme switching with OS preference detection

SecuBox Changes:
• Added theme.js manager for centralized theme control
• Implemented CSS variables for dark/light mode (secubox.css)
• Fixed hardcoded colors in dashboard.css, alerts.css, monitoring.css
• Integrated theme.js in all 7 views (dashboard, modules, alerts, monitoring, settings, etc.)
• Added get_theme RPC method to luci.secubox backend
• Updated ACL permissions to include get_theme (read access)
• Version updated to 0.1.1

System Hub Changes:
• Added theme.js manager using SecuBox theme API
• Implemented CSS variables for dark/light mode (dashboard.css)
• Integrated theme.js in all 9 views (overview, health, services, logs, backup, components, remote, settings, diagnostics)
• Version updated to 0.1.1
• README updated with maintainer info

Theme System Architecture:
• Configuration: /etc/config/secubox (option theme: dark|light|system)
• RPCD Backend: luci.secubox/get_theme method
• Frontend: theme.js modules (secubox/theme.js, system-hub/theme.js)
• CSS Variables: --sb-bg, --sb-bg-card, --sb-border, --sb-text, --sb-text-muted, --sb-shadow
• Auto-detection: prefers-color-scheme media query for system mode

Documentation:
• Added LUCI_DEVELOPMENT_REFERENCE.md with comprehensive LuCI development patterns
• Documented ubus/RPC types, baseclass.extend() patterns, ACL structure
• Common errors and solutions from implementation experience

Bug Fixes:
• Fixed SecuBox theme not applying visually (CSS variables now used)
• Fixed missing secubox.css in view imports
• Fixed ACL access denied for get_theme method
• Fixed hardcoded colors preventing theme switching

Testing:
• Verified theme switching works in all SecuBox tabs
• Verified theme switching works in all System Hub tabs
• Verified dark/light/system modes function correctly
• Verified single setting controls both plugins

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-26 16:09:15 +01:00
34fe2dc26a feat: complete System Hub implementation - central control dashboard
Implements comprehensive system control and monitoring dashboard with health
metrics, service management, system logs, and backup/restore functionality.

Features:
- Real-time system monitoring with visual gauges (CPU, RAM, Disk)
- Comprehensive system information (hostname, model, uptime, kernel)
- Health metrics with temperature monitoring and storage breakdown
- Service management with start/stop/restart/enable/disable actions
- System log viewer with filtering and configurable line count
- Configuration backup creation and download (base64 encoded)
- Configuration restore from backup file
- System reboot functionality with confirmation

Components:
- RPCD backend (luci.system-hub): 10 ubus methods
  * status, get_system_info, get_health
  * list_services, service_action
  * get_logs, backup_config, restore_config
  * reboot, get_storage
- 4 JavaScript views: overview, services, logs, backup
- ACL with read/write permissions segregation
- Comprehensive README with API documentation

Technical implementation:
- System info from /proc filesystem and sysinfo
- Health metrics: CPU load, memory breakdown, disk usage, temperature
- Service control via /etc/init.d scripts
- Log retrieval via logread with filtering
- Backup/restore using sysupgrade with base64 encoding
- Visual gauges with SVG circular progress indicators
- Color-coded health status (green/orange/red)

Dashboard Features:
- Circular gauges for CPU, Memory, Disk (120px with 10px stroke)
- System information cards with detailed metrics
- Temperature monitoring with thermal zone detection
- Storage table for all mount points with progress bars
- Service table with inline action buttons
- Terminal-style log display (black bg, green text)
- File upload for backup restore
- Modal confirmations for destructive actions

Architecture follows SecuBox standards:
- RPCD naming convention (luci. prefix)
- Menu paths match view file structure
- All JavaScript in strict mode
- Form-based configuration management
- Comprehensive error handling

Dependencies: coreutils, coreutils-base64

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 11:02:07 +01:00
16ad6d6a43 fix: rename all RPCD scripts to match ubus object names
All RPCD scripts must use the 'luci.' prefix to match their JavaScript
ubus object declarations. This fixes RPC errors like:
- "RPC call to luci.cdn-cache/status failed with error -32000: Object not found"

Renamed RPCD scripts:
- cdn-cache → luci.cdn-cache
- client-guardian → luci.client-guardian
- crowdsec → luci.crowdsec-dashboard
- netdata → luci.netdata-dashboard
- netifyd-dashboard → luci.netifyd-dashboard
- network-modes → luci.network-modes
- system-hub → luci.system-hub
- wireguard-dashboard → luci.wireguard-dashboard

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-24 09:51:45 +01:00