feat: capture Windows temps réel via mini serveur HTTP (port 5006)

- CaptureServer : serveur HTTP daemon sur l'agent Windows
- Capture fraîche mss en ~94ms à chaque requête
- Plus de lecture de vieux heartbeats sur disque
- Fallback capture locale si agent indisponible
- Firewall Windows port 5006 configuré

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-03-18 11:20:57 +01:00
parent ae65be2555
commit d4871249ea
4 changed files with 172 additions and 62 deletions

View File

@@ -111,25 +111,28 @@ export default function CapturePanel({
}
};
// Capture intelligente — auto-détection OS
// Capture intelligente — tente d'abord l'agent Windows distant,
// puis fallback sur la capture locale si l'agent est injoignable.
const doSmartCapture = async () => {
const isWindows = navigator.platform?.includes('Win') || navigator.userAgent?.includes('Windows');
if (isWindows) {
try {
const resp = await fetch('/api/screen-capture/capture-windows', { method: 'POST' });
const data = await resp.json();
if (data.image) {
setCurrentCapture({
screenshot_base64: data.image,
width: data.width,
height: data.height,
source: 'windows',
} as any);
}
} catch {}
} else {
onCapture();
try {
const resp = await fetch('/api/screen-capture/capture-windows', { method: 'POST' });
const data = await resp.json();
if (resp.ok && data.image) {
setCurrentCapture({
screenshot_base64: data.image,
width: data.width,
height: data.height,
source: data.source || 'windows',
} as any);
return;
}
// Agent indisponible — fallback capture locale
console.warn('Agent Windows indisponible, fallback local:', data.error);
} catch (err) {
console.warn('Erreur capture Windows, fallback local:', err);
}
// Fallback : capture locale (ecran du serveur Linux)
onCapture();
};
const handleTimerCapture = () => {