AP manageur V1.1 (Bêta)

This commit is contained in:
yoannmultigaming committed 2026-11-25 17:07:50 +01:00
1 parent 8f2ad04086
commit 23b6ccdfa4
5 files changed
+52 -9

No files matched your search

+41 -3
View File
@@ -9803,6 +9803,16 @@ ${vpnBadgeTopo}
if ($('btnUpdateAvailable')) {
$('btnUpdateAvailable').style.display = (configured && updateAvailable) ? 'inline-flex' : 'none';
}
if ($('startCaptureBtn')) {
const isWifiActive = !!(status && status.active);
if (!captureRunning) {
$('startCaptureBtn').disabled = !isWifiActive;
$('startCaptureBtn').style.opacity = isWifiActive ? '' : '0.45';
$('startCaptureBtn').style.cursor = isWifiActive ? 'pointer' : 'not-allowed';
$('startCaptureBtn').title = isWifiActive ? '' : t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames");
}
}
}
let lastUpdateData = null;
@@ -11934,8 +11944,19 @@ ${vpnBadgeTopo}
$('captureBufferSize').textContent = (capturePackets.length || buf) + ' ' + keptWord;
$('capturePcapSize').textContent = formatBytes(pcapSz);
if ($('captureDomainsCount')) $('captureDomainsCount').textContent = d.unique_domains_count !== undefined ? d.unique_domains_count : (d.domains ? d.domains.length : 0);
$('startCaptureBtn').style.display = captureRunning ? 'none' : '';
$('stopCaptureBtn').style.display = captureRunning ? 'inline-flex' : 'none';
const isWifiActive = !!(status && status.active);
const startBtn = $('startCaptureBtn');
const stopBtn = $('stopCaptureBtn');
if (startBtn) {
startBtn.style.display = captureRunning ? 'none' : '';
startBtn.disabled = !isWifiActive;
startBtn.style.opacity = isWifiActive ? '' : '0.45';
startBtn.style.cursor = isWifiActive ? 'pointer' : 'not-allowed';
startBtn.title = isWifiActive ? '' : t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames");
}
if (stopBtn) {
stopBtn.style.display = captureRunning ? 'inline-flex' : 'none';
}
if ($('statDns')) $('statDns').textContent = captureStats.dns || 0;
if ($('statIcmp')) $('statIcmp').textContent = captureStats.icmp || 0;
if ($('statTcp')) $('statTcp').textContent = captureStats.tcp || 0;
@@ -12295,11 +12316,28 @@ ${vpnBadgeTopo}
$('statsRangeYear').onclick = () => setStatsRange('year');
$('startCaptureBtn').onclick = () => runAction(async () => {
if (!status || !status.active) {
alert(t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames"));
return;
}
captureStartTime = Date.now() / 1000;
captureRunning = true;
ensureCaptureTimer();
updateCaptureTimerDisplay();
await apiFetch('/api/advanced/capture/start', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' });
try {
const res = await apiFetch('/api/advanced/capture/start', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' });
const data = await res.json();
if (!res.ok || (data && !data.ok)) {
throw Error((data && data.message) || t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames"));
}
} catch (err) {
captureRunning = false;
captureStartTime = null;
stopCaptureTimer();
alert(tErr(err.message));
await loadCaptureStatus();
return;
}
await loadCaptureStatus();
await loadCapturePackets(true);
ensureCapturePolling();