AP manageur V1.1 (Bêta)

This commit is contained in:
yoannmultigaming committed 2026-11-25 18:31:11 +01:00
1 parent bfc0475665
commit f1b3179a16
5 files changed
+96 -73

No files matched your search

+28 -30
View File
@@ -3198,6 +3198,10 @@
</div>
</div>
<div class="card">
<div id="captureWifiNotice" style="display:none;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.3);color:var(--red);padding:10px 14px;border-radius:8px;margin-bottom:14px;font-size:13px;align-items:center;gap:10px">
<span style="font-size:16px">⚠️</span>
<span data-i18n="adv_pcap_wifi_notice">Le point d’accès Wi-Fi est inactif. L’analyse et la capture de trames réseau sont désactivées tant que le Wi-Fi n’est pas démarré.</span>
</div>
<div class="topline" style="flex-wrap:wrap;gap:12px;margin-bottom:12px">
<div>
<h2 style="margin:0 0 4px" data-i18n="adv_pcap_title">Analyseur Réseau Wi-Fi (Wireshark)</h2>
@@ -9426,14 +9430,6 @@ ${vpnBadgeTopo}
const icon = getDeviceTypeIcon(client.device_type);
const nameEsc = String(client.name || t('client_unknown', 'Client inconnu')).replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
const ipEsc = String(client.ip || '—').replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
const macEsc = String(client.mac || '—').replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
const sigDbm = client.signal_dbm !== null && client.signal_dbm !== undefined ? client.signal_dbm : null;
let sigColor = 'var(--red)';
if (sigDbm !== null) {
if (sigDbm >= -50) sigColor = 'var(--green)';
else if (sigDbm >= -60) sigColor = '#68d391';
else if (sigDbm >= -70) sigColor = '#f6ad55';
}
const clientVpnDesc = client.vpn_profile_name ? (client.vpn_routed ? `<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap"><span style="display:inline-flex;align-items:center">${typeof VPN_LOGOS !== 'undefined' && VPN_LOGOS[client.vpn_profile_type] ? VPN_LOGOS[client.vpn_profile_type] : '🛡️'}</span> <strong>${escapeHtml(client.vpn_profile_name)}</strong> ${client.vpn_public_ip ? (typeof formatIpWithGeo === 'function' ? formatIpWithGeo(client.vpn_public_ip, client.vpn_public_ip_geo) : `<code>${escapeHtml(client.vpn_public_ip)}</code>`) : ''}</div>` : `⚠️ ${escapeHtml(client.vpn_profile_name)} ${t('vpn_status_disconnected_short', '(Coupé)')}`) : ('🌐 ' + t('topo_direct_wan', 'Direct WAN (Box)'));
title.innerHTML = `<span>${icon}</span> ${t('topo_modal_dev_details', 'Détails de l’équipement : {name}').replace('{name}', nameEsc)} <span class="pill pill-green pill-no-dot" style="font-size:11px;margin-left:auto">${t('topo_modal_live_badge', 'En direct')}</span>`;
body.innerHTML = `
@@ -9724,6 +9720,27 @@ ${vpnBadgeTopo}
});
}
function updateCaptureControlsState() {
const isWifiActive = !!(status && status.active);
const startBtn = $('startCaptureBtn');
const stopBtn = $('stopCaptureBtn');
const notice = $('captureWifiNotice');
if (notice) {
notice.style.display = isWifiActive ? 'none' : 'flex';
}
if (startBtn) {
startBtn.style.display = captureRunning ? 'none' : '';
startBtn.disabled = !isWifiActive;
startBtn.style.opacity = isWifiActive ? '1' : '0.45';
startBtn.style.cursor = isWifiActive ? 'pointer' : 'not-allowed';
startBtn.style.filter = isWifiActive ? 'none' : 'grayscale(0.85)';
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';
}
}
function updateApButtons() {
const active = !!(status && status.active), configured = !!(status && status.configured);
if ($('dashboardView')) $('dashboardView').classList.toggle('active', currentTab === 'dashboard');
@@ -9804,15 +9821,7 @@ ${vpnBadgeTopo}
$('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");
}
}
updateCaptureControlsState();
}
let lastUpdateData = null;
@@ -11944,19 +11953,7 @@ ${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);
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';
}
updateCaptureControlsState();
if ($('statDns')) $('statDns').textContent = captureStats.dns || 0;
if ($('statIcmp')) $('statIcmp').textContent = captureStats.icmp || 0;
if ($('statTcp')) $('statTcp').textContent = captureStats.tcp || 0;
@@ -16096,6 +16093,7 @@ ${vpnBadgeTopo}
loadVpnClients();
stopCaptureTimer();
} else {
updateCaptureControlsState();
loadCaptureStatus();
loadCapturePackets(true);
ensureCapturePolling();