APmanageur Wi-Fi V1.0

This commit is contained in:
yoannmultigaming committed 2026-11-21 03:29:09 +01:00
1 parent fe6594b964
commit ceeab6fa4a
7 files changed
+369 -6

No files matched your search

+184 -2
View File
@@ -130,6 +130,32 @@
line-height: 1;
}
.btn-update-available {
background: rgba(16, 185, 129, 0.16) !important;
color: #10b981 !important;
border: 1px solid rgba(16, 185, 129, 0.5) !important;
box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
transition: all 0.2s ease-in-out;
cursor: pointer;
}
.btn-update-available:hover {
background: rgba(16, 185, 129, 0.28) !important;
border-color: #10b981 !important;
box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
transform: translateY(-1px);
}
.btn-update-available .update-arrow-svg {
animation: pulse-update-arrow 2s infinite ease-in-out;
flex-shrink: 0;
}
@keyframes pulse-update-arrow {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-2.5px); }
}
nav {
display: flex;
gap: 8px;
@@ -2014,6 +2040,10 @@
width: 100%
}
.btn-update-available {
grid-column: span 2;
}
.topo-clients-grid {
grid-template-columns: 1fr !important
}
@@ -2489,6 +2519,10 @@
<button id="apControl" type="button" data-i18n="btn_start">Démarrer</button>
<button id="apRestart" class="secondary" type="button" data-i18n="btn_restart">Redémarrer</button>
<button id="refresh" data-i18n="btn_refresh">Actualiser</button>
<button id="btnUpdateAvailable" class="btn-update-available" type="button" style="display:none" onclick="openUpdateModal()" title="Mise à jour disponible">
<svg class="update-arrow-svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
<span data-i18n="header_update_available">Mise à jour disponible</span>
</button>
<button id="headerLangBtn" class="secondary" type="button" onclick="openLanguageSettings()"
title="Paramètres de langue / Language settings">
<span id="headerLangFlag" style="display:inline-flex;align-items:center;line-height:1"></span>
@@ -5635,6 +5669,67 @@
</div>
</div>
<!-- Modal Mise à jour de l'application -->
<div id="modalUpdateApp" class="modal-overlay">
<div class="modal-card" style="max-width:540px">
<div class="modal-header">
<h3 style="margin:0;font-size:17px;display:flex;align-items:center;gap:8px">
<span style="color:#10b981;display:inline-flex;align-items:center">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 19V5M5 12l7-7 7 7"/></svg>
</span>
<span data-i18n="update_modal_title">Mise à jour disponible</span>
</h3>
<button id="closeUpdateModal" class="secondary" type="button" style="padding:4px 10px;font-size:16px;border-radius:6px" onclick="closeUpdateModal()">✕</button>
</div>
<div class="modal-body" style="gap:16px">
<div style="background:rgba(16,185,129,0.1);border:1px solid rgba(16,185,129,0.3);border-radius:8px;padding:12px;display:flex;align-items:center;gap:12px">
<span style="font-size:24px;line-height:1">🚀</span>
<div style="font-size:13px;line-height:1.4">
<div style="font-weight:600;color:#10b981" data-i18n="update_new_version_found">Une nouvelle version de AP Manageur est prête !</div>
<div style="color:var(--text2);font-size:12px" data-i18n="update_new_version_desc">Une mise à jour plus récente de l'application est disponible sur le dépôt.</div>
</div>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr;gap:10px;font-size:13px">
<div style="background:var(--panel2);padding:10px 12px;border-radius:8px;border:1px solid var(--line)">
<div style="color:var(--text2);font-size:11px;text-transform:uppercase;font-weight:600;margin-bottom:4px" data-i18n="update_current_commit">Version actuelle</div>
<div id="updateCurrentCommit" style="font-family:monospace;font-weight:700;color:var(--text)">—</div>
</div>
<div style="background:var(--panel2);padding:10px 12px;border-radius:8px;border:1px solid var(--line)">
<div style="color:var(--text2);font-size:11px;text-transform:uppercase;font-weight:600;margin-bottom:4px" data-i18n="update_latest_commit">Dernière version (Gitea)</div>
<div id="updateLatestCommit" style="font-family:monospace;font-weight:700;color:#10b981">—</div>
</div>
</div>
<div id="updateCommitMsgBox" style="background:var(--panel2);padding:10px 12px;border-radius:8px;border:1px solid var(--line);font-size:12px">
<div style="color:var(--text2);font-size:11px;text-transform:uppercase;font-weight:600;margin-bottom:4px" data-i18n="update_commit_info">Détails du commit</div>
<div id="updateCommitMsg" style="font-style:italic;color:var(--text);margin-bottom:6px;word-break:break-word">—</div>
<div style="color:var(--text2);font-size:11px;display:flex;gap:10px;flex-wrap:wrap">
<span id="updateCommitAuthor"></span>
<span id="updateCommitDate"></span>
</div>
</div>
<div>
<label style="display:block;font-size:12px;font-weight:600;margin-bottom:6px" data-i18n="update_how_to">Pour mettre à jour votre conteneur Docker :</label>
<div style="display:flex;gap:8px;align-items:center">
<input type="text" id="updateDockerCmd" readonly value="docker compose pull && docker compose up -d" style="flex:1;background:var(--bg);font-family:monospace;font-size:12px;padding:8px 10px;border-radius:6px;border:1px solid var(--line);color:var(--text);cursor:text" onclick="this.select()">
<button type="button" class="secondary" id="btnCopyUpdateCmd" onclick="copyUpdateCommand()" style="white-space:nowrap;padding:8px 12px;font-size:12px">
<span id="btnCopyUpdateCmdText" data-i18n="btn_copy">Copier</span>
</button>
</div>
<div style="font-size:11px;color:var(--text2);margin-top:6px" data-i18n="update_cmd_hint">Exécutez cette commande dans le dossier de votre projet sur votre serveur hôte.</div>
</div>
</div>
<div class="modal-footer" style="justify-content:space-between">
<button type="button" class="secondary" id="btnCheckUpdateManual" onclick="triggerManualUpdateCheck()" style="font-size:12px">
🔄 <span data-i18n="btn_recheck">Vérifier à nouveau</span>
</button>
<button type="button" class="secondary" onclick="closeUpdateModal()" data-i18n="btn_close">Fermer</button>
</div>
</div>
</div>
<div id="topoDetailModal" class="modal-overlay">
<div class="modal-card">
<div class="modal-header">
@@ -8533,6 +8628,12 @@ ${vpnBadgeTopo}
if ($('apControl')) $('apControl').style.display = configured ? '' : 'none';
if ($('apRestart')) $('apRestart').style.display = configured && active ? '' : 'none';
if ($('refresh')) $('refresh').style.display = configured ? '' : 'none';
const updateInfo = (status && status.update) ? status.update : null;
if (updateInfo) lastUpdateData = updateInfo;
const updateAvailable = !!(updateInfo && updateInfo.available);
if ($('btnUpdateAvailable')) {
$('btnUpdateAvailable').style.display = (configured && updateAvailable) ? 'inline-flex' : 'none';
}
if (configured && $('apControl')) {
$('apControl').textContent = active ? t('btn_stop', 'Arrêter') : t('btn_start', 'Démarrer');
$('apControl').style.background = active ? 'var(--red)' : 'var(--blue)';
@@ -8540,6 +8641,77 @@ ${vpnBadgeTopo}
}
}
let lastUpdateData = null;
function openUpdateModal() {
const modal = $('modalUpdateApp');
if (!modal) return;
const u = lastUpdateData || (status && status.update) || {};
if ($('updateCurrentCommit')) $('updateCurrentCommit').textContent = u.current_commit || (u.current_commit_full ? u.current_commit_full.substring(0, 7) : '—');
if ($('updateLatestCommit')) $('updateLatestCommit').textContent = u.latest_commit || (u.latest_commit_full ? u.latest_commit_full.substring(0, 7) : '—');
if ($('updateCommitMsg')) $('updateCommitMsg').textContent = u.commit_msg || t('update_no_msg', 'Aucun message de commit');
if ($('updateCommitAuthor')) $('updateCommitAuthor').textContent = u.author ? ('Par ' + u.author) : '';
if ($('updateCommitDate')) {
let dStr = '';
if (u.date) {
try { dStr = 'le ' + new Date(u.date).toLocaleString(); } catch (_) { dStr = 'le ' + u.date; }
}
$('updateCommitDate').textContent = dStr;
}
modal.classList.add('active');
}
window.openUpdateModal = openUpdateModal;
function closeUpdateModal() {
const modal = $('modalUpdateApp');
if (modal) modal.classList.remove('active');
}
window.closeUpdateModal = closeUpdateModal;
async function copyUpdateCommand() {
const input = $('updateDockerCmd');
const btnText = $('btnCopyUpdateCmdText');
if (!input) return;
const cmd = input.value;
try {
if (navigator.clipboard && navigator.clipboard.writeText) {
await navigator.clipboard.writeText(cmd);
} else {
input.select();
document.execCommand('copy');
}
if (btnText) {
const original = btnText.textContent;
btnText.textContent = t('update_cmd_copied', '✓ Copié !');
setTimeout(() => { if (btnText) btnText.textContent = original; }, 2000);
}
} catch (err) {
input.select();
document.execCommand('copy');
}
}
window.copyUpdateCommand = copyUpdateCommand;
async function triggerManualUpdateCheck() {
const btn = $('btnCheckUpdateManual');
if (btn) btn.disabled = true;
try {
const res = await apiFetch('/api/system/update?force=1', { cache: 'no-store' });
if (res.ok) {
const u = await res.json();
lastUpdateData = u;
if (status) status.update = u;
updateApButtons();
openUpdateModal();
}
} catch (e) {
console.warn('Erreur vérification mise à jour :', e);
} finally {
if (btn) btn.disabled = false;
}
}
window.triggerManualUpdateCheck = triggerManualUpdateCheck;
async function toggleBlock(mac, blocked) {
return runAction(async () => {
try {
@@ -8990,6 +9162,7 @@ ${vpnBadgeTopo}
const d = await res.json();
if (!res.ok) throw new Error(d.error || 'Erreur lors de la suppression');
await loadDevices();
await load();
} catch (e) {
alert(tErr(e.message));
}
@@ -9110,8 +9283,8 @@ ${vpnBadgeTopo}
function setBwPreset(downMbps, upMbps) {
if ($('inputRateDown')) $('inputRateDown').value = downMbps;
if ($('selectRateDownUnit')) $('selectRateDownUnit').value = 'Mbps';
if ($('selectQuotaUnit')) $('selectQuotaUnit').value = unit;
updateQuotaPreview();
if ($('inputRateUp')) $('inputRateUp').value = upMbps;
if ($('selectRateUpUnit')) $('selectRateUpUnit').value = 'Mbps';
}
async function onQuotaPeriodChanged() {
@@ -14596,6 +14769,10 @@ ${vpnBadgeTopo}
if (m && m.classList.contains('active')) {
closeEasterEggModal();
}
const mu = $('modalUpdateApp');
if (mu && mu.classList.contains('active')) {
closeUpdateModal();
}
}
});
if ($('modalEasterEggGames')) {
@@ -14603,6 +14780,11 @@ ${vpnBadgeTopo}
if (e.target === $('modalEasterEggGames')) closeEasterEggModal();
};
}
if ($('modalUpdateApp')) {
$('modalUpdateApp').onclick = (e) => {
if (e.target === $('modalUpdateApp')) closeUpdateModal();
};
}
</script>
</body>