Bump version to 1.0.10
Smart WoL: TCP pre-check before sending magic packet (3s timeout). Machine status updates via SSE: online/offline tracked in DB and broadcast to all connected browser tabs in real-time. - Pre-check: if machine already reachable, skip WoL and mark online - WoL path: send 3 magic packets, wait for SSH, mark online/offline - Backend: setMachineStatus() helper + machine_status SSE event - Frontend: subscribeMachineStatus() SSE helper for Machines + Dashboard - IsReachable() helper in wol package for TCP reachability checks
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
export interface MachineStatusEvent {
|
||||
type: 'machine_status';
|
||||
machine_id: number;
|
||||
status: string;
|
||||
key?: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
export function subscribeMachineStatus(
|
||||
onUpdate: (evt: MachineStatusEvent) => void
|
||||
): () => void {
|
||||
const es = new EventSource('/api/jobs/stream');
|
||||
es.addEventListener('machine_status', (ev) => {
|
||||
try {
|
||||
const data = JSON.parse((ev as MessageEvent).data);
|
||||
onUpdate(data as MachineStatusEvent);
|
||||
} catch {
|
||||
// ignore parse errors
|
||||
}
|
||||
});
|
||||
return () => es.close();
|
||||
}
|
||||
Reference in New Issue
Block a user