espilon-source/tools/C3PO/static/js/store.js
Eun0us 79c2a4d4bf c3po: full server rewrite with modular routes and honeypot dashboard
Replace monolithic CLI and web server with route-based Flask API.
New routes: api_commands, api_build, api_can, api_monitor, api_ota,
api_tunnel. Add honeypot security dashboard with real-time SSE,
MITRE ATT&CK mapping, kill chain analysis.

New TUI with commander/help modules. Add session management,
tunnel proxy core, CAN bus data store. Docker support.
2026-02-28 20:12:27 +01:00

58 lines
1.8 KiB
JavaScript

/* ESPILON C2 — Alpine.js global store */
document.addEventListener('alpine:init', () => {
Alpine.store('app', {
devices: [],
stats: { connected_devices: 0, active_cameras: 0, multilateration_scanners: 0 },
serverOnline: true,
sidebarCollapsed: localStorage.getItem('espilon_sidebar') === '1',
async fetchDevices() {
try {
const res = await fetch('/api/devices');
if (!res.ok) throw new Error(res.status);
const data = await res.json();
this.devices = data.devices || [];
this.serverOnline = true;
} catch (e) {
this.serverOnline = false;
}
},
async fetchStats() {
try {
const res = await fetch('/api/stats');
if (!res.ok) throw new Error(res.status);
this.stats = await res.json();
this.serverOnline = true;
} catch (e) {
this.serverOnline = false;
}
},
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed;
localStorage.setItem('espilon_sidebar', this.sidebarCollapsed ? '1' : '0');
},
connectedDevices() {
return this.devices.filter(d => d.status === 'Connected');
},
offlineDevices() {
return this.devices.filter(d => d.status !== 'Connected');
},
deviceIds() {
return this.connectedDevices().map(d => d.id);
},
init() {
this.fetchDevices();
this.fetchStats();
setInterval(() => this.fetchDevices(), 5000);
setInterval(() => this.fetchStats(), 10000);
}
});
});