From 1f8f2959501ddd4c979d818814dfcf56871e9942 Mon Sep 17 00:00:00 2001
From: yoannmultigaming
Date: Thu, 19 Nov 2026 23:49:42 +0100
Subject: [PATCH] APmanageur Wi-Fi V1.0
---
Dockerfile | 2 +
ap.py | 24 ++
index.html | 695 ++++++++++++++++++++++++------------------
jeux/dino.html | 587 +++++++++++++++++++++++++++++++++++
jeux/tetris.html | 664 ++++++++++++++++++++++++++++++++++++++++
jeux/zipline.html | 762 ++++++++++++++++++++++++++++++++++++++++++++++
lang/en-gb.js | 1 +
lang/en-us.js | 1 +
lang/fr.js | 1 +
9 files changed, 2445 insertions(+), 292 deletions(-)
create mode 100644 jeux/dino.html
create mode 100644 jeux/tetris.html
create mode 100644 jeux/zipline.html
diff --git a/Dockerfile b/Dockerfile
index 7fa05e0..5f49ed9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -32,6 +32,8 @@ COPY lang/ /app/lang/
COPY lang/ /var/www/html/lang/
COPY themes/ /app/themes/
COPY themes/ /var/www/html/themes/
+COPY jeux/ /app/jeux/
+COPY jeux/ /var/www/html/jeux/
# L'API n'est plus joignable que via Apache : le HTML appelle /api sur le même port (1001)
RUN sed -i 's#const API_URL=[^;]*;#const API_URL="";#' /app/index.html /var/www/html/index.html /app/setup.html /var/www/html/setup.html 2>/dev/null || true
COPY apache-ap.conf /etc/apache2/sites-available/000-default.conf
diff --git a/ap.py b/ap.py
index 61a733f..bea7e77 100644
--- a/ap.py
+++ b/ap.py
@@ -9868,6 +9868,30 @@ class Handler(BaseHTTPRequestHandler):
except OSError: pass
self.send_error(404, 'Fichier de thème introuvable')
return
+ if self.path.startswith('/jeux/'):
+ clean_name = os.path.basename(urllib.parse.urlparse(self.path).path)
+ game_path = os.path.join(os.path.dirname(__file__), 'jeux', clean_name)
+ ext = os.path.splitext(clean_name)[1].lower()
+ mime_map = {
+ '.html': 'text/html; charset=utf-8',
+ '.js': 'application/javascript; charset=utf-8',
+ '.css': 'text/css; charset=utf-8',
+ '.png': 'image/png',
+ '.svg': 'image/svg+xml',
+ '.ico': 'image/x-icon'
+ }
+ if os.path.isfile(game_path) and ext in mime_map:
+ try:
+ body = open(game_path, 'rb').read()
+ self.send_response(200)
+ self.send_header('Content-Type', mime_map[ext])
+ self.send_header('Content-Length', str(len(body)))
+ self.end_headers()
+ self.wfile.write(body)
+ return
+ except OSError: pass
+ self.send_error(404, 'Jeu introuvable')
+ return
if self.path == '/favicon.png' or self.path.startswith('/images/'):
clean_name = 'favicon.png' if self.path == '/favicon.png' else os.path.basename(urllib.parse.urlparse(self.path).path)
img_path = os.path.join(os.path.dirname(__file__), 'images', clean_name)
diff --git a/index.html b/index.html
index 3f5df62..c687c6c 100644
--- a/index.html
+++ b/index.html
@@ -512,6 +512,35 @@
color: #e6f6ff !important;
}
+ /* Boutons de sélection de jeu Easter Egg */
+ .game-switch-btn.active {
+ background: var(--blue) !important;
+ color: var(--blue-text, #071326) !important;
+ border-color: var(--blue) !important;
+ font-weight: 700 !important;
+ }
+ html[data-theme="light"] .game-switch-btn.active,
+ html[data-theme="winxp"] .game-switch-btn.active,
+ html[data-theme="macos"][data-macos-mode="light"] .game-switch-btn.active,
+ html[data-theme="macos"]:not([data-macos-mode="dark"]) .game-switch-btn.active {
+ background: var(--blue) !important;
+ color: #ffffff !important;
+ }
+
+ .game-switch-btn.active {
+ background: var(--blue) !important;
+ color: var(--blue-text, #071326) !important;
+ border-color: var(--blue) !important;
+ font-weight: 700 !important;
+ }
+ html[data-theme="light"] .game-switch-btn.active,
+ html[data-theme="winxp"] .game-switch-btn.active,
+ html[data-theme="macos"][data-macos-mode="light"] .game-switch-btn.active,
+ html[data-theme="macos"]:not([data-macos-mode="dark"]) .game-switch-btn.active {
+ background: var(--blue) !important;
+ color: #ffffff !important;
+ }
+
#btnAuthPasskey {
border: 1px solid rgba(56, 189, 248, 0.4);
background: rgba(56, 189, 248, 0.08);
@@ -6157,6 +6186,32 @@
+
+
+
@@ -8807,6 +8862,93 @@ ${vpnBadgeTopo}
}
}
+ /* --- Easter Egg Arcade Games (jeu:Tetris, jeu:dino, jeu:zipline) --- */
+ let currentEasterEggGame = 'tetris';
+
+ window.openEasterEggModal = function (gameName = 'tetris') {
+ const modal = $('modalEasterEggGames');
+ if (!modal) return;
+ modal.classList.add('active');
+ modal.style.display = 'flex';
+ switchEasterEggGame(gameName);
+ };
+
+ window.closeEasterEggModal = function () {
+ const modal = $('modalEasterEggGames');
+ if (modal) {
+ modal.classList.remove('active');
+ modal.style.display = 'none';
+ }
+ const iframe = $('easterEggGameIframe');
+ if (iframe) iframe.src = '';
+ };
+
+ window.switchEasterEggGame = function (gameName) {
+ currentEasterEggGame = gameName;
+ const validGames = ['tetris', 'dino', 'zipline'];
+ if (!validGames.includes(gameName)) gameName = 'tetris';
+
+ document.querySelectorAll('.game-switch-btn').forEach(btn => {
+ const isActive = (btn.id === 'btnEggGame_' + gameName);
+ btn.classList.toggle('active', isActive);
+ });
+
+ const iframe = $('easterEggGameIframe');
+ if (iframe) {
+ iframe.src = '/jeux/' + gameName + '.html';
+ setTimeout(() => {
+ try { iframe.focus(); if (iframe.contentWindow) iframe.contentWindow.focus(); } catch (e) { }
+ }, 150);
+ }
+ };
+
+ function parseEasterEggGameName(rawVal) {
+ if (!rawVal || typeof rawVal !== 'string') return null;
+ const clean = rawVal.trim();
+ const m = clean.match(/^jeu\s*:\s*(.*)$/i) || (clean.toLowerCase() === 'jeu' ? ['', 'tetris'] : null);
+ if (!m) return null;
+ let g = (m[1] || 'tetris').trim().toLowerCase();
+ if (g === 'dinausore' || g === 'dinosaure' || g === 'trex' || g === 't-rex' || g === 'chrome') return 'dino';
+ if (g === 'zip' || g === 'zipline' || g === 'linkedin') return 'zipline';
+ if (g === 'tetris' || g === '') return 'tetris';
+ return g;
+ }
+
+ function attachEasterEggTrigger(inputEl) {
+ if (!inputEl) return;
+ inputEl.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') {
+ const game = parseEasterEggGameName(inputEl.value);
+ if (game) {
+ e.preventDefault();
+ e.stopPropagation();
+ openEasterEggModal(game);
+ }
+ }
+ });
+ }
+
+ // Attacher le déclencheur aux barres de recherche de l'onglet Avancé
+ attachEasterEggTrigger($('vpnClientsSearchInput'));
+ attachEasterEggTrigger($('packetFilterInput'));
+ // Et pour une meilleure accessibilité, à la recherche des appareils également
+ attachEasterEggTrigger($('devicesSearchInput'));
+
+ // Fermeture par la touche Échap et clic extérieur
+ window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ const m = $('modalEasterEggGames');
+ if (m && m.classList.contains('active')) {
+ closeEasterEggModal();
+ }
+ }
+ });
+ if ($('modalEasterEggGames')) {
+ $('modalEasterEggGames').onclick = (e) => {
+ if (e.target === $('modalEasterEggGames')) closeEasterEggModal();
+ };
+ }
+
async function toggleBlockDevice(mac, blocked) {
try {
await toggleBlock(mac, blocked);
@@ -8817,6 +8959,93 @@ ${vpnBadgeTopo}
}
}
+ /* --- Easter Egg Arcade Games (jeu:Tetris, jeu:dino, jeu:zipline) --- */
+ let currentEasterEggGame = 'tetris';
+
+ window.openEasterEggModal = function (gameName = 'tetris') {
+ const modal = $('modalEasterEggGames');
+ if (!modal) return;
+ modal.classList.add('active');
+ modal.style.display = 'flex';
+ switchEasterEggGame(gameName);
+ };
+
+ window.closeEasterEggModal = function () {
+ const modal = $('modalEasterEggGames');
+ if (modal) {
+ modal.classList.remove('active');
+ modal.style.display = 'none';
+ }
+ const iframe = $('easterEggGameIframe');
+ if (iframe) iframe.src = '';
+ };
+
+ window.switchEasterEggGame = function (gameName) {
+ currentEasterEggGame = gameName;
+ const validGames = ['tetris', 'dino', 'zipline'];
+ if (!validGames.includes(gameName)) gameName = 'tetris';
+
+ document.querySelectorAll('.game-switch-btn').forEach(btn => {
+ const isActive = (btn.id === 'btnEggGame_' + gameName);
+ btn.classList.toggle('active', isActive);
+ });
+
+ const iframe = $('easterEggGameIframe');
+ if (iframe) {
+ iframe.src = '/jeux/' + gameName + '.html';
+ setTimeout(() => {
+ try { iframe.focus(); if (iframe.contentWindow) iframe.contentWindow.focus(); } catch (e) { }
+ }, 150);
+ }
+ };
+
+ function parseEasterEggGameName(rawVal) {
+ if (!rawVal || typeof rawVal !== 'string') return null;
+ const clean = rawVal.trim();
+ const m = clean.match(/^jeu\s*:\s*(.*)$/i) || (clean.toLowerCase() === 'jeu' ? ['', 'tetris'] : null);
+ if (!m) return null;
+ let g = (m[1] || 'tetris').trim().toLowerCase();
+ if (g === 'dinausore' || g === 'dinosaure' || g === 'trex' || g === 't-rex' || g === 'chrome') return 'dino';
+ if (g === 'zip' || g === 'zipline' || g === 'linkedin') return 'zipline';
+ if (g === 'tetris' || g === '') return 'tetris';
+ return g;
+ }
+
+ function attachEasterEggTrigger(inputEl) {
+ if (!inputEl) return;
+ inputEl.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') {
+ const game = parseEasterEggGameName(inputEl.value);
+ if (game) {
+ e.preventDefault();
+ e.stopPropagation();
+ openEasterEggModal(game);
+ }
+ }
+ });
+ }
+
+ // Attacher le déclencheur aux barres de recherche de l'onglet Avancé
+ attachEasterEggTrigger($('vpnClientsSearchInput'));
+ attachEasterEggTrigger($('packetFilterInput'));
+ // Et pour une meilleure accessibilité, à la recherche des appareils également
+ attachEasterEggTrigger($('devicesSearchInput'));
+
+ // Fermeture par la touche Échap et clic extérieur
+ window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ const m = $('modalEasterEggGames');
+ if (m && m.classList.contains('active')) {
+ closeEasterEggModal();
+ }
+ }
+ });
+ if ($('modalEasterEggGames')) {
+ $('modalEasterEggGames').onclick = (e) => {
+ if (e.target === $('modalEasterEggGames')) closeEasterEggModal();
+ };
+ }
+
async function deleteDeviceHistory(mac) {
const dev = devicesDataCache.find(d => d.mac.toUpperCase() === mac.toUpperCase());
const name = dev ? dev.name : mac;
@@ -8835,6 +9064,93 @@ ${vpnBadgeTopo}
}
}
+ /* --- Easter Egg Arcade Games (jeu:Tetris, jeu:dino, jeu:zipline) --- */
+ let currentEasterEggGame = 'tetris';
+
+ window.openEasterEggModal = function (gameName = 'tetris') {
+ const modal = $('modalEasterEggGames');
+ if (!modal) return;
+ modal.classList.add('active');
+ modal.style.display = 'flex';
+ switchEasterEggGame(gameName);
+ };
+
+ window.closeEasterEggModal = function () {
+ const modal = $('modalEasterEggGames');
+ if (modal) {
+ modal.classList.remove('active');
+ modal.style.display = 'none';
+ }
+ const iframe = $('easterEggGameIframe');
+ if (iframe) iframe.src = '';
+ };
+
+ window.switchEasterEggGame = function (gameName) {
+ currentEasterEggGame = gameName;
+ const validGames = ['tetris', 'dino', 'zipline'];
+ if (!validGames.includes(gameName)) gameName = 'tetris';
+
+ document.querySelectorAll('.game-switch-btn').forEach(btn => {
+ const isActive = (btn.id === 'btnEggGame_' + gameName);
+ btn.classList.toggle('active', isActive);
+ });
+
+ const iframe = $('easterEggGameIframe');
+ if (iframe) {
+ iframe.src = '/jeux/' + gameName + '.html';
+ setTimeout(() => {
+ try { iframe.focus(); if (iframe.contentWindow) iframe.contentWindow.focus(); } catch (e) { }
+ }, 150);
+ }
+ };
+
+ function parseEasterEggGameName(rawVal) {
+ if (!rawVal || typeof rawVal !== 'string') return null;
+ const clean = rawVal.trim();
+ const m = clean.match(/^jeu\s*:\s*(.*)$/i) || (clean.toLowerCase() === 'jeu' ? ['', 'tetris'] : null);
+ if (!m) return null;
+ let g = (m[1] || 'tetris').trim().toLowerCase();
+ if (g === 'dinausore' || g === 'dinosaure' || g === 'trex' || g === 't-rex' || g === 'chrome') return 'dino';
+ if (g === 'zip' || g === 'zipline' || g === 'linkedin') return 'zipline';
+ if (g === 'tetris' || g === '') return 'tetris';
+ return g;
+ }
+
+ function attachEasterEggTrigger(inputEl) {
+ if (!inputEl) return;
+ inputEl.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') {
+ const game = parseEasterEggGameName(inputEl.value);
+ if (game) {
+ e.preventDefault();
+ e.stopPropagation();
+ openEasterEggModal(game);
+ }
+ }
+ });
+ }
+
+ // Attacher le déclencheur aux barres de recherche de l'onglet Avancé
+ attachEasterEggTrigger($('vpnClientsSearchInput'));
+ attachEasterEggTrigger($('packetFilterInput'));
+ // Et pour une meilleure accessibilité, à la recherche des appareils également
+ attachEasterEggTrigger($('devicesSearchInput'));
+
+ // Fermeture par la touche Échap et clic extérieur
+ window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ const m = $('modalEasterEggGames');
+ if (m && m.classList.contains('active')) {
+ closeEasterEggModal();
+ }
+ }
+ });
+ if ($('modalEasterEggGames')) {
+ $('modalEasterEggGames').onclick = (e) => {
+ if (e.target === $('modalEasterEggGames')) closeEasterEggModal();
+ };
+ }
+
/* ============================================================
Gestion des Quotas & Limitation de Débit par Appareil
============================================================ */
@@ -8852,295 +9168,6 @@ ${vpnBadgeTopo}
if ($('limitsModalMac')) $('limitsModalMac').value = cleanMac;
if ($('limitsDevName')) $('limitsDevName').textContent = dev.name || 'Client sans nom';
if ($('limitsDevMac')) $('limitsDevMac').textContent = cleanMac;
- if ($('limitsDevIp')) $('limitsDevIp').textContent = dev.ip && dev.ip !== 'Non attribuée' ? dev.ip : 'Non attribuée';
- if ($('limitsDevAvatar')) $('limitsDevAvatar').innerHTML = getDeviceTypeIcon(dev.device_type);
- if ($('deviceLimitsMsg')) $('deviceLimitsMsg').style.display = 'none';
-
- function applyLimitsToForm(lim) {
- lim = lim || {};
- if ($('chkLimitsQuotaEnabled')) $('chkLimitsQuotaEnabled').checked = !!lim.quota_enabled;
-
- // Quota bytes -> valeur + unité
- const qBytes = lim.quota_bytes || 0;
- if (qBytes > 0) {
- if (qBytes % 1073741824 === 0 || qBytes >= 1073741824) {
- if ($('inputQuotaValue')) $('inputQuotaValue').value = (qBytes / 1073741824);
- if ($('selectQuotaUnit')) $('selectQuotaUnit').value = 'GB';
- } else {
- if ($('inputQuotaValue')) $('inputQuotaValue').value = Math.round(qBytes / 1048576);
- if ($('selectQuotaUnit')) $('selectQuotaUnit').value = 'MB';
- }
- } else {
- if ($('inputQuotaValue')) $('inputQuotaValue').value = 10;
- if ($('selectQuotaUnit')) $('selectQuotaUnit').value = 'GB';
- }
- if ($('selectQuotaPeriod')) $('selectQuotaPeriod').value = lim.quota_period || 'total';
-
- // Bande passante
- if ($('chkLimitsBwEnabled')) $('chkLimitsBwEnabled').checked = !!lim.bandwidth_enabled;
- const downKbps = lim.rate_down_kbps || 0;
- if (downKbps >= 1000 && downKbps % 1000 === 0) {
- if ($('inputRateDown')) $('inputRateDown').value = downKbps / 1000;
- if ($('selectRateDownUnit')) $('selectRateDownUnit').value = 'Mbps';
- } else {
- if ($('inputRateDown')) $('inputRateDown').value = downKbps || 10;
- if ($('selectRateDownUnit')) $('selectRateDownUnit').value = downKbps ? 'Kbps' : 'Mbps';
- }
-
- const upKbps = lim.rate_up_kbps || 0;
- if (upKbps >= 1000 && upKbps % 1000 === 0) {
- if ($('inputRateUp')) $('inputRateUp').value = upKbps / 1000;
- if ($('selectRateUpUnit')) $('selectRateUpUnit').value = 'Mbps';
- } else {
- if ($('inputRateUp')) $('inputRateUp').value = upKbps || 5;
- if ($('selectRateUpUnit')) $('selectRateUpUnit').value = upKbps ? 'Kbps' : 'Mbps';
- }
-
- toggleQuotaInputs();
- toggleBwInputs();
- updateQuotaPreview();
- }
-
- // Appliquer immédiatement les données en cache pour ouverture instantanée
- applyLimitsToForm(currentLimitsDev.limits || {});
-
- const modal = $('modalDeviceLimits');
- if (modal) modal.classList.add('active');
-
- // Rafraîchir en arrière-plan depuis l'API
- try {
- const res = await apiFetch(`/api/devices/limits?mac=${encodeURIComponent(cleanMac)}`, { timeout: 15000 });
- if (res.ok) {
- const data = await res.json();
- if (data && data.limits) {
- currentLimitsDev.limits = data.limits;
- applyLimitsToForm(currentLimitsDev.limits);
- }
- }
- } catch (e) {
- console.warn("Impossible de rafraîchir les limites de l'appareil :", e);
- }
- }
-
- function closeDeviceLimitsModal() {
- const modal = $('modalDeviceLimits');
- if (modal) modal.classList.remove('active');
- currentLimitsDev = null;
- }
-
- function toggleQuotaInputs() {
- const enabled = $('chkLimitsQuotaEnabled') && $('chkLimitsQuotaEnabled').checked;
- const container = $('quotaInputsContainer');
- if (container) container.style.display = enabled ? 'flex' : 'none';
- updateQuotaPreview();
- }
-
- function toggleBwInputs() {
- const enabled = $('chkLimitsBwEnabled') && $('chkLimitsBwEnabled').checked;
- const container = $('bwInputsContainer');
- if (container) container.style.display = enabled ? 'flex' : 'none';
- }
-
- function setQuotaPreset(val, unit) {
- if ($('inputQuotaValue')) $('inputQuotaValue').value = val;
- if ($('selectQuotaUnit')) $('selectQuotaUnit').value = unit;
- updateQuotaPreview();
- }
-
- function setBwPreset(downMbps, upMbps) {
- if ($('inputRateDown')) $('inputRateDown').value = downMbps;
- if ($('selectRateDownUnit')) $('selectRateDownUnit').value = 'Mbps';
- if ($('inputRateUp')) $('inputRateUp').value = upMbps;
- if ($('selectRateUpUnit')) $('selectRateUpUnit').value = 'Mbps';
- }
-
- async function onQuotaPeriodChanged() {
- if (!currentLimitsDev) return;
- try {
- const res = await apiFetch(`/api/devices/limits?mac=${encodeURIComponent(currentLimitsDev.mac)}`);
- if (res.ok) {
- const data = await res.json();
- if (data && data.limits) {
- currentLimitsDev.limits = data.limits;
- }
- }
- } catch (_) { }
- updateQuotaPreview();
- }
-
- function updateQuotaPreview() {
- if (!currentLimitsDev) return;
- const lim = currentLimitsDev.limits || {};
- const usageBytes = lim.usage_bytes || 0;
- const usageStr = lim.usage_bytes_str || formatBytes(usageBytes);
-
- let qVal = parseFloat($('inputQuotaValue') ? $('inputQuotaValue').value : 0) || 0;
- const qUnit = $('selectQuotaUnit') ? $('selectQuotaUnit').value : 'GB';
- const qBytes = qUnit === 'GB' ? Math.round(qVal * 1073741824) : Math.round(qVal * 1048576);
-
- const exceeded = qBytes > 0 && usageBytes >= qBytes;
- const pct = qBytes > 0 ? Math.min(100, Math.round((usageBytes / qBytes) * 100)) : 0;
- const remaining = Math.max(0, qBytes - usageBytes);
-
- if ($('quotaExceededBadge')) $('quotaExceededBadge').style.display = exceeded ? 'inline-block' : 'none';
-
- if ($('quotaUsageLabel')) {
- $('quotaUsageLabel').textContent = `${usageStr} / ${formatBytes(qBytes)} (${pct}%)`;
- $('quotaUsageLabel').style.color = exceeded ? 'var(--red)' : (pct >= 85 ? '#f59e0b' : 'var(--text)');
- }
- if ($('quotaUsageBar')) {
- $('quotaUsageBar').style.width = `${pct}%`;
- $('quotaUsageBar').style.background = exceeded ? 'var(--red)' : (pct >= 85 ? '#f59e0b' : 'var(--blue)');
- }
- if ($('quotaRemainingLabel')) {
- $('quotaRemainingLabel').textContent = exceeded ? t('modal_quota_exhausted', 'Quota épuisé (0 o restant)') : `${t('modal_quota_remaining', 'Reste :')} ${formatBytes(remaining)}`;
- $('quotaRemainingLabel').style.color = exceeded ? 'var(--red)' : 'var(--muted)';
- }
- }
-
- async function resetDeviceTrafficUsage() {
- if (!currentLimitsDev) return;
- const mac = currentLimitsDev.mac;
- const name = currentLimitsDev.name || mac;
- if (!confirm(t('confirm_reset_quota', "Voulez-vous remettre à zéro le compteur de données de l'appareil « {name} » ?").replace('{name}', name))) return;
-
- try {
- const res = await apiFetch('/api/devices/limits', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- timeout: 30000,
- body: JSON.stringify({
- mac: mac,
- quota_enabled: $('chkLimitsQuotaEnabled') && $('chkLimitsQuotaEnabled').checked,
- quota_bytes: getSelectedQuotaBytes(),
- quota_period: $('selectQuotaPeriod') ? $('selectQuotaPeriod').value : 'total',
- bandwidth_enabled: $('chkLimitsBwEnabled') && $('chkLimitsBwEnabled').checked,
- rate_down_kbps: getSelectedRateDownKbps(),
- rate_up_kbps: getSelectedRateUpKbps(),
- reset_usage: true
- })
- });
- const d = await res.json();
- if (!res.ok) throw new Error(d.error || 'Erreur lors de la réinitialisation');
-
- if (d.limits) currentLimitsDev.limits = d.limits;
- updateQuotaPreview();
- const msg = $('deviceLimitsMsg');
- if (msg) {
- msg.style.display = 'block';
- msg.style.background = 'rgba(50,213,131,0.15)';
- msg.style.color = 'var(--green)';
- msg.textContent = t('modal_counter_reset_ok', '✓ Compteur de consommation remis à zéro !');
- setTimeout(() => { if (msg) msg.style.display = 'none'; }, 4000);
- }
- try { await loadDevices(); } catch (_) { }
- try { await load(); } catch (_) { }
- } catch (e) {
- alert(tErr(e.message));
- }
- }
-
- function getSelectedQuotaBytes() {
- const val = parseFloat($('inputQuotaValue') ? $('inputQuotaValue').value : 0) || 0;
- const unit = $('selectQuotaUnit') ? $('selectQuotaUnit').value : 'GB';
- return unit === 'GB' ? Math.round(val * 1073741824) : Math.round(val * 1048576);
- }
-
- function getSelectedRateDownKbps() {
- const val = parseFloat($('inputRateDown') ? $('inputRateDown').value : 0) || 0;
- const unit = $('selectRateDownUnit') ? $('selectRateDownUnit').value : 'Mbps';
- return unit === 'Mbps' ? Math.round(val * 1000) : Math.round(val);
- }
-
- function getSelectedRateUpKbps() {
- const val = parseFloat($('inputRateUp') ? $('inputRateUp').value : 0) || 0;
- const unit = $('selectRateUpUnit') ? $('selectRateUpUnit').value : 'Mbps';
- return unit === 'Mbps' ? Math.round(val * 1000) : Math.round(val);
- }
-
- async function submitDeviceLimits() {
- if (!currentLimitsDev) return;
- const mac = currentLimitsDev.mac;
- const btn = $('btnSaveDeviceLimits');
- const msg = $('deviceLimitsMsg');
-
- const quotaEnabled = $('chkLimitsQuotaEnabled') && $('chkLimitsQuotaEnabled').checked;
- const quotaBytes = getSelectedQuotaBytes();
- const quotaPeriod = $('selectQuotaPeriod') ? $('selectQuotaPeriod').value : 'total';
-
- const bwEnabled = $('chkLimitsBwEnabled') && $('chkLimitsBwEnabled').checked;
- const rateDownKbps = getSelectedRateDownKbps();
- const rateUpKbps = getSelectedRateUpKbps();
-
- if (btn) { btn.disabled = true; btn.textContent = t('loading', 'Enregistrement…'); }
- if (msg) {
- msg.style.display = 'block';
- msg.style.background = 'rgba(56,189,248,0.12)';
- msg.style.color = 'var(--blue)';
- msg.textContent = t('modal_saving', 'Application des quotas et limitations réseau…');
- }
-
- try {
- const res = await apiFetch('/api/devices/limits', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- timeout: 30000,
- body: JSON.stringify({
- mac,
- quota_enabled: quotaEnabled,
- quota_bytes: quotaBytes,
- quota_period: quotaPeriod,
- bandwidth_enabled: bwEnabled,
- rate_down_kbps: rateDownKbps,
- rate_up_kbps: rateUpKbps,
- quota_action: 'block'
- })
- });
- const d = await res.json();
- if (!res.ok) throw new Error(d.error || 'Erreur lors de l’enregistrement');
-
- if (msg) {
- msg.style.background = 'rgba(50,213,131,0.15)';
- msg.style.color = 'var(--green)';
- msg.textContent = t('modal_saved_ok', '✓ Limitations enregistrées et appliquées avec succès !');
- }
-
- setTimeout(() => {
- closeDeviceLimitsModal();
- }, 900);
-
- try { await loadDevices(); } catch (_) { }
- try { await load(); } catch (_) { }
- } catch (e) {
- if (msg) {
- msg.style.background = 'rgba(239,68,68,0.15)';
- msg.style.color = 'var(--red)';
- msg.textContent = tErr(e.message);
- }
- } finally {
- if (btn) { btn.disabled = false; btn.innerHTML = '💾 ' + t('modal_save_limits', 'Enregistrer les limitations'); }
- }
- }
-
- let selectedDeviceType = 'generic';
-
- function openDeviceTypeModal(mac) {
- const dev = devicesDataCache.find(d => d.mac.toUpperCase() === mac.toUpperCase());
- if (!dev) return;
- $('deviceTypeModalMac').value = dev.mac;
- $('deviceTypeModalName').textContent = dev.name || 'Client sans nom';
- $('deviceTypeModalMacDisplay').textContent = dev.mac;
-
- const statusEl = $('deviceTypeModalStatus');
- if (statusEl) {
- if (dev.blocked) {
- statusEl.className = 'pill';
- statusEl.style.cssText = 'background:rgba(255,107,107,.15);color:var(--red);border:1px solid rgba(255,107,107,.3);font-size:11px;font-weight:600';
- statusEl.textContent = '🔴 ' + t('status_blocked', 'Bloqué');
- } else if (dev.connected) {
- statusEl.className = 'pill pill-green pill-no-dot';
- statusEl.style.cssText = 'font-size:11px;font-weight:600';
- statusEl.textContent = '🟢 ' + t('status_connected', 'Connecté');
} else {
statusEl.className = 'pill';
statusEl.style.cssText = 'background:var(--panel2);color:var(--muted);font-size:11px';
@@ -14293,9 +14320,93 @@ ${vpnBadgeTopo}
}
}
-
-
-
+ /* --- Easter Egg Arcade Games (jeu:Tetris, jeu:dino, jeu:zipline) --- */
+ let currentEasterEggGame = 'tetris';
+
+ window.openEasterEggModal = function (gameName = 'tetris') {
+ const modal = $('modalEasterEggGames');
+ if (!modal) return;
+ modal.classList.add('active');
+ modal.style.display = 'flex';
+ switchEasterEggGame(gameName);
+ };
+
+ window.closeEasterEggModal = function () {
+ const modal = $('modalEasterEggGames');
+ if (modal) {
+ modal.classList.remove('active');
+ modal.style.display = 'none';
+ }
+ const iframe = $('easterEggGameIframe');
+ if (iframe) iframe.src = '';
+ };
+
+ window.switchEasterEggGame = function (gameName) {
+ currentEasterEggGame = gameName;
+ const validGames = ['tetris', 'dino', 'zipline'];
+ if (!validGames.includes(gameName)) gameName = 'tetris';
+
+ document.querySelectorAll('.game-switch-btn').forEach(btn => {
+ const isActive = (btn.id === 'btnEggGame_' + gameName);
+ btn.classList.toggle('active', isActive);
+ });
+
+ const iframe = $('easterEggGameIframe');
+ if (iframe) {
+ iframe.src = '/jeux/' + gameName + '.html';
+ setTimeout(() => {
+ try { iframe.focus(); if (iframe.contentWindow) iframe.contentWindow.focus(); } catch (e) { }
+ }, 150);
+ }
+ };
+
+ function parseEasterEggGameName(rawVal) {
+ if (!rawVal || typeof rawVal !== 'string') return null;
+ const clean = rawVal.trim();
+ const m = clean.match(/^jeu\s*:\s*(.*)$/i) || (clean.toLowerCase() === 'jeu' ? ['', 'tetris'] : null);
+ if (!m) return null;
+ let g = (m[1] || 'tetris').trim().toLowerCase();
+ if (g === 'dinausore' || g === 'dinosaure' || g === 'trex' || g === 't-rex' || g === 'chrome') return 'dino';
+ if (g === 'zip' || g === 'zipline' || g === 'linkedin') return 'zipline';
+ if (g === 'tetris' || g === '') return 'tetris';
+ return g;
+ }
+
+ function attachEasterEggTrigger(inputEl) {
+ if (!inputEl) return;
+ inputEl.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') {
+ const game = parseEasterEggGameName(inputEl.value);
+ if (game) {
+ e.preventDefault();
+ e.stopPropagation();
+ openEasterEggModal(game);
+ }
+ }
+ });
+ }
+
+ // Attacher le déclencheur aux barres de recherche de l'onglet Avancé
+ attachEasterEggTrigger($('vpnClientsSearchInput'));
+ attachEasterEggTrigger($('packetFilterInput'));
+ // Et pour une meilleure accessibilité, à la recherche des appareils également
+ attachEasterEggTrigger($('devicesSearchInput'));
+
+ // Fermeture par la touche Échap et clic extérieur
+ window.addEventListener('keydown', (e) => {
+ if (e.key === 'Escape') {
+ const m = $('modalEasterEggGames');
+ if (m && m.classList.contains('active')) {
+ closeEasterEggModal();
+ }
+ }
+ });
+ if ($('modalEasterEggGames')) {
+ $('modalEasterEggGames').onclick = (e) => {
+ if (e.target === $('modalEasterEggGames')) closeEasterEggModal();
+ };
+ }
+
+
+
+
+
+
+
+
+
G A M E O V E R
+
+
+
+
+
+
Espace ou ⬆️ : Sauter
+
⬇️ : Se baisser / descente rapide
+
Toucher l'écran pour sauter
+
+
+
+
+
diff --git a/jeux/dino.html b/jeux/dino.html
new file mode 100644
index 0000000..6aa0b53
--- /dev/null
+++ b/jeux/dino.html
@@ -0,0 +1,587 @@
+
+
+