AP manageur V1.2 (Bêta)
This commit is contained in:
1 parent
9b86c11a24
commit
c48d5beae0
2 files changed
+129
-2
No files matched your search
+127
@@ -9384,6 +9384,133 @@ ${vpnBadgeTopo}
|
|||||||
? (rate ? ` <small style="opacity:.78;font-weight:500">(${Math.round(rate)} Mbps)</small>` : ` <small style="opacity:.78;font-weight:500">(~)</small>`)
|
? (rate ? ` <small style="opacity:.78;font-weight:500">(${Math.round(rate)} Mbps)</small>` : ` <small style="opacity:.78;font-weight:500">(~)</small>`)
|
||||||
: ` <small style="opacity:.78;font-weight:500">(${val} dBm)</small>`;
|
: ` <small style="opacity:.78;font-weight:500">(${val} dBm)</small>`;
|
||||||
const tip = isEst
|
const tip = isEst
|
||||||
|
? (rate ? `Estimé via lien Wi-Fi ${rate} MBit/s (pilote Raspberry Pi brcmfmac)` : `Qualité estimée via les statistiques de paquets (pilote Raspberry Pi brcmfmac)`)
|
||||||
|
: `${val} dBm`;
|
||||||
|
if (val >= -50) return `<span class="signal signal-excellent" title="${tip}">${t('signal_excellent', 'Excellent')}${suffix}</span>`;
|
||||||
|
if (val >= -60) return `<span class="signal signal-bon" title="${tip}">${t('signal_good', 'Bon')}${suffix}</span>`;
|
||||||
|
if (val >= -70) return `<span class="signal signal-moyen" title="${tip}">${t('signal_fair', 'Moyen')}${suffix}</span>`;
|
||||||
|
return `<span class="signal signal-faible" title="${tip}">${t('signal_weak', 'Faible')}${suffix}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cleanQrBox(box) {
|
||||||
|
if (!box) return;
|
||||||
|
const canvas = box.querySelector('canvas');
|
||||||
|
const img = box.querySelector('img');
|
||||||
|
if (!canvas && !img) return;
|
||||||
|
if (img && img.src && img.src.startsWith('data:image')) {
|
||||||
|
img.style.display = 'block'; img.style.width = '100%'; img.style.height = '100%';
|
||||||
|
if (canvas) canvas.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (canvas) {
|
||||||
|
try {
|
||||||
|
const dataUrl = canvas.toDataURL('image/png');
|
||||||
|
if (dataUrl && dataUrl.length > 50) {
|
||||||
|
if (img) {
|
||||||
|
img.src = dataUrl; img.style.display = 'block'; img.style.width = '100%'; img.style.height = '100%';
|
||||||
|
canvas.remove(); return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (_) { }
|
||||||
|
canvas.style.display = 'block'; canvas.style.width = '100%'; canvas.style.height = '100%';
|
||||||
|
if (img) img.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (img) { img.style.display = 'block'; img.style.width = '100%'; img.style.height = '100%' }
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentSettingsTab = 'wifi';
|
||||||
|
let currentNotifSubTab = sessionStorage.getItem('apNotifSubTab') || 'services';
|
||||||
|
function selectNotifSubTab(subTab) {
|
||||||
|
currentNotifSubTab = subTab;
|
||||||
|
sessionStorage.setItem('apNotifSubTab', subTab);
|
||||||
|
const isServices = subTab === 'services';
|
||||||
|
const isAlerts = subTab === 'alerts';
|
||||||
|
const ts = $('tabNotifServices'), ta = $('tabNotifAlerts');
|
||||||
|
if (ts) { ts.classList.toggle('active', isServices); ts.setAttribute('aria-selected', isServices); }
|
||||||
|
if (ta) { ta.classList.toggle('active', isAlerts); ta.setAttribute('aria-selected', isAlerts); }
|
||||||
|
const ps = $('panelNotifServices'), pa = $('panelNotifAlerts');
|
||||||
|
if (ps) ps.style.display = isServices ? 'block' : 'none';
|
||||||
|
if (pa) pa.style.display = isAlerts ? 'block' : 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectSettingsTab(tabKey) {
|
||||||
|
if (tabKey === '2fa') tabKey = 'admin';
|
||||||
|
currentSettingsTab = tabKey;
|
||||||
|
const tabs = ['wifi', 'admin', 'vpn', 'proxy', 'notif', 'custom', 'backup', 'danger'];
|
||||||
|
tabs.forEach(k => {
|
||||||
|
const btnId = 'tabSettings' + k.charAt(0).toUpperCase() + k.slice(1);
|
||||||
|
const panelId = 'panelSettings' + k.charAt(0).toUpperCase() + k.slice(1);
|
||||||
|
const btn = $(btnId); const panel = $(panelId);
|
||||||
|
if (btn) {
|
||||||
|
btn.classList.toggle('active', k === tabKey);
|
||||||
|
btn.setAttribute('aria-selected', k === tabKey ? 'true' : 'false');
|
||||||
|
}
|
||||||
|
if (panel) {
|
||||||
|
panel.style.display = (k === tabKey) ? 'block' : 'none';
|
||||||
|
panel.classList.toggle('active', k === tabKey);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (tabKey === 'admin') { if (typeof loadAdminUser === 'function') loadAdminUser(); if (typeof loadSessions === 'function') loadSessions(); if (typeof loadPasskeysList === 'function') loadPasskeysList(); if (typeof loadApiKeys === 'function') loadApiKeys(); }
|
||||||
|
if (tabKey === 'vpn') {
|
||||||
|
if (typeof loadVpnProfiles === 'function') loadVpnProfiles();
|
||||||
|
if (typeof loadVpnClients === 'function') loadVpnClients();
|
||||||
|
startVpnTabRefresh();
|
||||||
|
}
|
||||||
|
if (tabKey === 'proxy') {
|
||||||
|
if (typeof loadReverseProxySettings === 'function') loadReverseProxySettings();
|
||||||
|
}
|
||||||
|
if (tabKey === 'notif') {
|
||||||
|
if (typeof selectNotifSubTab === 'function') selectNotifSubTab(currentNotifSubTab || 'services');
|
||||||
|
if (typeof loadNotificationSettings === 'function') loadNotificationSettings();
|
||||||
|
}
|
||||||
|
if (tabKey === 'custom') {
|
||||||
|
if (typeof loadDeviceTypes === 'function') loadDeviceTypes();
|
||||||
|
if (typeof loadUpdateSettings === 'function') loadUpdateSettings();
|
||||||
|
}
|
||||||
|
if (tabKey === 'backup') {
|
||||||
|
if (typeof loadBackupsTab === 'function') loadBackupsTab();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let vpnTabRefreshTimer = null;
|
||||||
|
function startVpnTabRefresh() {
|
||||||
|
if (vpnTabRefreshTimer) clearInterval(vpnTabRefreshTimer);
|
||||||
|
vpnTabRefreshTimer = setInterval(() => {
|
||||||
|
if (authToken && currentTab === 'settings' && currentSettingsTab === 'vpn') {
|
||||||
|
if (typeof loadVpnProfiles === 'function') loadVpnProfiles();
|
||||||
|
if (typeof loadVpnClients === 'function') loadVpnClients();
|
||||||
|
} else {
|
||||||
|
clearInterval(vpnTabRefreshTimer);
|
||||||
|
vpnTabRefreshTimer = null;
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function qr() {
|
||||||
|
if (!status.ssid || !status.password) return;
|
||||||
|
let box = $('qrcode'); let signature = status.ssid + '\u0000' + status.password;
|
||||||
|
if (signature === qrSignature) return;
|
||||||
|
$('qrPassword').value = status.password; box.replaceChildren();
|
||||||
|
new QRCode(box, { text: `WIFI:T:WPA;S:${esc(status.ssid)};P:${esc(status.password)};;`, width: 190, height: 190 });
|
||||||
|
cleanQrBox(box);
|
||||||
|
setTimeout(() => cleanQrBox(box), 50);
|
||||||
|
setTimeout(() => cleanQrBox(box), 200);
|
||||||
|
qrSignature = signature;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function controlAp(action) {
|
||||||
|
return runAction(async () => {
|
||||||
|
try {
|
||||||
|
const response = await apiFetch('/api/ap/control', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ action }) });
|
||||||
|
const data = await response.json(); if (!response.ok) throw Error(data.error || 'Action refusée');
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 1000)); await load();
|
||||||
|
} catch (e) { alert(tErr(e.message)) }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateApButtons() {
|
||||||
|
const active = !!status.active, configured = !!status.configured;
|
||||||
if ($('dashboardView')) $('dashboardView').classList.toggle('active', currentTab === 'dashboard');
|
if ($('dashboardView')) $('dashboardView').classList.toggle('active', currentTab === 'dashboard');
|
||||||
if ($('statsView')) $('statsView').classList.toggle('active', configured && currentTab === 'stats');
|
if ($('statsView')) $('statsView').classList.toggle('active', configured && currentTab === 'stats');
|
||||||
if ($('devicesView')) $('devicesView').classList.toggle('active', configured && currentTab === 'devices');
|
if ($('devicesView')) $('devicesView').classList.toggle('active', configured && currentTab === 'devices');
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "V1.2 (Bêta)",
|
"version": "V1.2 (Bêta)",
|
||||||
"commit": "44c2048d3b501f41a2d9a36f56250b897d13258e",
|
"commit": "9b86c11a24a29494d9ab541d856e66573c572469",
|
||||||
"build_date": "2026-11-23T01:26:27Z"
|
"build_date": "2026-11-23T01:52:05Z"
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user