secubox-openwrt/luci-app-secubox/htdocs/luci-static/resources/secubox/api.js
CyberMind-FR 33f3b89393 feat: Bump version to 0.3.1 for enhanced modules
Updated three core modules with significant UI/UX improvements:

SecuBox Central Hub (luci-app-secubox):
- Changed header icon from 🛡️ to 🚀 ("SecuBox Control Center")
- Added module filter tabs (All/Security/Network/System/Monitoring)
- Implemented alert dismiss and clear functionality
- Enhanced backend RPCD methods for alert management
- Updated ACL permissions for new alert methods

System Hub (luci-app-system-hub):
- Changed header icon from 🖥️ to ⚙️ ("System Control Center")
- Added 4-column System Info Grid with interactive cards
- Implemented Quick Status Indicators (Internet/DNS/NTP/Firewall)
- Added hostname edit and kernel version copy features
- Enhanced CSS with monospace fonts and responsive design

Network Modes (luci-app-network-modes):
- Changed header icon from ⚙️ to 🌐 ("Network Configuration")
- Added Current Mode Display Card with config summary
- Implemented Mode Comparison Table (5 modes, 6 features)
- Active mode highlighting with gradient effects
- Added "Change Mode" button with gradient styling

All modules validated with comprehensive checks (RPCD, ACL, permissions).

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-27 10:28:12 +01:00

151 lines
3.0 KiB
JavaScript

'use strict';
'require baseclass';
'require rpc';
/**
* SecuBox Master API
* Package: luci-app-secubox
* RPCD object: luci.secubox
*/
// Version: 0.2.2
var callStatus = rpc.declare({
object: 'luci.secubox',
method: 'status',
expect: { }
});
var callModules = rpc.declare({
object: 'luci.secubox',
method: 'modules',
expect: {}
});
var callModulesByCategory = rpc.declare({
object: 'luci.secubox',
method: 'modules_by_category',
params: ['category'],
expect: {}
});
var callModuleInfo = rpc.declare({
object: 'luci.secubox',
method: 'module_info',
params: ['module'],
expect: { }
});
var callStartModule = rpc.declare({
object: 'luci.secubox',
method: 'start_module',
params: ['module']
});
var callStopModule = rpc.declare({
object: 'luci.secubox',
method: 'stop_module',
params: ['module']
});
var callRestartModule = rpc.declare({
object: 'luci.secubox',
method: 'restart_module',
params: ['module']
});
var callHealth = rpc.declare({
object: 'luci.secubox',
method: 'health',
expect: { checks: [], overall: '' }
});
var callDiagnostics = rpc.declare({
object: 'luci.secubox',
method: 'diagnostics',
expect: { }
});
var callSystemHealth = rpc.declare({
object: 'luci.secubox',
method: 'get_system_health',
expect: { }
});
var callAlerts = rpc.declare({
object: 'luci.secubox',
method: 'get_alerts',
expect: { alerts: [] }
});
var callQuickAction = rpc.declare({
object: 'luci.secubox',
method: 'quick_action',
params: ['action'],
expect: { }
});
var callDashboardData = rpc.declare({
object: 'luci.secubox',
method: 'get_dashboard_data',
expect: { }
});
var callGetTheme = rpc.declare({
object: 'luci.secubox',
method: 'get_theme',
expect: { }
});
var callDismissAlert = rpc.declare({
object: 'luci.secubox',
method: 'dismiss_alert',
params: ['alert_id'],
expect: { }
});
var callClearAlerts = rpc.declare({
object: 'luci.secubox',
method: 'clear_alerts',
expect: { }
});
function formatUptime(seconds) {
if (!seconds) return '0s';
var d = Math.floor(seconds / 86400);
var h = Math.floor((seconds % 86400) / 3600);
var m = Math.floor((seconds % 3600) / 60);
if (d > 0) return d + 'd ' + h + 'h';
if (h > 0) return h + 'h ' + m + 'm';
return m + 'm';
}
function formatBytes(bytes) {
if (!bytes) return '0 B';
var k = 1024;
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
var i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toFixed(2) + ' ' + sizes[i];
}
return baseclass.extend({
getStatus: callStatus,
getModules: callModules,
getModulesByCategory: callModulesByCategory,
getModuleInfo: callModuleInfo,
startModule: callStartModule,
stopModule: callStopModule,
restartModule: callRestartModule,
getHealth: callHealth,
getDiagnostics: callDiagnostics,
getSystemHealth: callSystemHealth,
getAlerts: callAlerts,
quickAction: callQuickAction,
getDashboardData: callDashboardData,
getTheme: callGetTheme,
dismissAlert: callDismissAlert,
clearAlerts: callClearAlerts,
formatUptime: formatUptime,
formatBytes: formatBytes
});