AP manageur V1.2 (Bêta)
This commit is contained in:
1 parent
e905ce9097
commit
7fb398090d
5 files changed
+385
-42
No files matched your search
+317
-37
@@ -2999,6 +2999,83 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Progression Configuration Initiale (Setup) -->
|
||||
<div id="modalSetupStartProgress"
|
||||
style="display:none;position:fixed;inset:0;background:rgba(0,0,0,0.85);backdrop-filter:blur(6px);z-index:999999;align-items:center;justify-content:center;padding:16px">
|
||||
<div class="card"
|
||||
style="max-width:480px;width:92%;padding:28px 24px;border:1px solid rgba(56,189,248,0.4);box-shadow:0 16px 40px rgba(0,0,0,0.6), 0 0 30px rgba(56,189,248,0.2);border-radius:18px;display:flex;flex-direction:column;align-items:center;gap:18px;background:var(--panel)">
|
||||
|
||||
<!-- Icône animée -->
|
||||
<div style="position:relative;width:68px;height:68px;display:flex;align-items:center;justify-content:center">
|
||||
<div style="position:absolute;inset:0;border-radius:50%;border:2px solid rgba(56,189,248,0.35);animation:radarPulse 2s ease-out infinite"></div>
|
||||
<div id="setupStartIcon" style="font-size:34px;z-index:1;animation:iconFloat 2s ease-in-out infinite">🚀</div>
|
||||
</div>
|
||||
|
||||
<!-- Titre et badge -->
|
||||
<div style="text-align:center">
|
||||
<h2 style="margin:0;font-size:18px;letter-spacing:-0.3px;color:var(--text)" data-i18n="setup_launch_modal_title">Configuration initiale & Démarrage</h2>
|
||||
<div style="margin-top:6px;display:inline-flex;align-items:center;gap:6px;background:rgba(56,189,248,0.12);border:1px solid rgba(56,189,248,0.3);color:var(--blue);padding:3px 12px;border-radius:20px;font-size:12px;font-weight:600">
|
||||
<span id="setupStartBadgeIcon" style="display:inline-flex;align-items:center;justify-content:center;animation:spin 1.5s linear infinite">⚙️</span>
|
||||
<span id="setupStartBadgeText" data-i18n="setup_launch_badge">Configuration en cours…</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Barre de progression -->
|
||||
<div style="width:100%;margin-top:4px">
|
||||
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:12px">
|
||||
<span id="setupStartStepLabel" style="font-weight:600;color:var(--text)" data-i18n="setup_step_label">Étape 1 / 5</span>
|
||||
<span id="setupStartPercent" style="font-weight:700;color:var(--blue);font-family:monospace">0%</span>
|
||||
</div>
|
||||
<div style="height:10px;border-radius:8px;background:var(--panel2);border:1px solid var(--line);overflow:hidden">
|
||||
<div id="setupStartProgressBar" style="width:0%;height:100%;background:linear-gradient(90deg, #0284c7, #38bdf8);box-shadow:0 0 12px rgba(56,189,248,0.5);border-radius:8px;transition:width .35s ease"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Libellés d'état dynamique -->
|
||||
<div style="text-align:center;min-height:44px;width:100%">
|
||||
<div id="setupStartStatusText" style="font-weight:700;font-size:14px;color:var(--text)" data-i18n="setup_launch_starting">Démarrage de la configuration…</div>
|
||||
<div id="setupStartDetails" class="muted" style="font-size:12px;margin-top:3px" data-i18n="setup_launch_details">Initialisation des services et validation des données…</div>
|
||||
</div>
|
||||
|
||||
<!-- Checklist visuelle des étapes -->
|
||||
<div style="display:grid;grid-template-columns:1fr;gap:7px;width:100%;margin-top:4px;border-top:1px solid var(--line);padding-top:12px">
|
||||
<div id="setupStepAdmin" class="loader-step active" style="display:flex;align-items:center;gap:8px;padding:7px 12px;background:var(--panel2);border-radius:8px;border:1px solid rgba(56,189,248,0.4);font-size:12.5px">
|
||||
<span class="step-icon">🛡️</span>
|
||||
<span class="step-name" style="flex:1" data-i18n="setup_step1_admin">Création du compte administrateur & session</span>
|
||||
<span class="step-state" id="setupStepAdminState" style="font-weight:700;color:var(--blue)">↻</span>
|
||||
</div>
|
||||
<div id="setupStepWifi" class="loader-step" style="display:flex;align-items:center;gap:8px;padding:7px 12px;background:var(--panel2);border-radius:8px;border:1px solid transparent;font-size:12.5px">
|
||||
<span class="step-icon">📶</span>
|
||||
<span class="step-name" style="flex:1" data-i18n="setup_step2_wifi">Configuration & démarrage du Wi-Fi</span>
|
||||
<span class="step-state" id="setupStepWifiState">⏳</span>
|
||||
</div>
|
||||
<div id="setupStepVpn" class="loader-step" style="display:flex;align-items:center;gap:8px;padding:7px 12px;background:var(--panel2);border-radius:8px;border:1px solid transparent;font-size:12.5px">
|
||||
<span class="step-icon">🌐</span>
|
||||
<span class="step-name" style="flex:1" data-i18n="setup_step3_vpn">Enregistrement des profils VPN</span>
|
||||
<span class="step-state" id="setupStepVpnState">⏳</span>
|
||||
</div>
|
||||
<div id="setupStepNotif" class="loader-step" style="display:flex;align-items:center;gap:8px;padding:7px 12px;background:var(--panel2);border-radius:8px;border:1px solid transparent;font-size:12.5px">
|
||||
<span class="step-icon">🔔</span>
|
||||
<span class="step-name" style="flex:1" data-i18n="setup_step4_notif">Paramétrage des alertes & notifications</span>
|
||||
<span class="step-state" id="setupStepNotifState">⏳</span>
|
||||
</div>
|
||||
<div id="setupStepPrefs" class="loader-step" style="display:flex;align-items:center;gap:8px;padding:7px 12px;background:var(--panel2);border-radius:8px;border:1px solid transparent;font-size:12.5px">
|
||||
<span class="step-icon">⚙️</span>
|
||||
<span class="step-name" style="flex:1" data-i18n="setup_step5_prefs">Préférences, mises à jour & sauvegardes</span>
|
||||
<span class="step-state" id="setupStepPrefsState">⏳</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="setupStartErrorBox" style="display:none;width:100%;margin-top:8px;padding:10px;background:rgba(239,68,68,0.15);border:1px solid var(--red);border-radius:8px;color:var(--red);font-size:12px;text-align:center">
|
||||
<span id="setupStartErrorText"></span>
|
||||
<div style="margin-top:8px">
|
||||
<button type="button" class="secondary" style="padding:4px 10px;font-size:12px" onclick="closeSetupStartProgressModal()">Fermer</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal Ajout de Profil VPN en Étape 5 -->
|
||||
<div id="modalSetupVpn"
|
||||
style="display:none;position:fixed;inset:0;background:rgba(0,0,0,0.72);backdrop-filter:blur(4px);z-index:9999;align-items:center;justify-content:center;padding:16px">
|
||||
@@ -3268,6 +3345,27 @@
|
||||
'recap_auto_start_no': 'Démarrage auto : Non',
|
||||
'btn_modify_settings': '← Modifier les réglages',
|
||||
'btn_submit_setup': '🚀 Enregistrer et démarrer l\'AP',
|
||||
'setup_launch_modal_title': 'Configuration initiale & Démarrage',
|
||||
'setup_launch_badge': 'Configuration en cours…',
|
||||
'setup_launch_badge_complete': 'Configuration réussie !',
|
||||
'setup_step_label': 'Étape {step} / 5',
|
||||
'setup_launch_starting': 'Démarrage de la configuration…',
|
||||
'setup_launch_details': 'Initialisation des services et validation des données…',
|
||||
'setup_step1_admin': 'Création du compte administrateur & session',
|
||||
'setup_step2_wifi': 'Configuration & démarrage du Wi-Fi',
|
||||
'setup_step3_vpn': 'Enregistrement des profils VPN',
|
||||
'setup_step4_notif': 'Paramétrage des alertes & notifications',
|
||||
'setup_step5_prefs': 'Préférences, mises à jour & sauvegardes',
|
||||
'setup_step1_admin_title': 'Création du compte administrateur…',
|
||||
'setup_step1_admin_desc': 'Sécurisation des identifiants et création de la session…',
|
||||
'setup_step2_wifi_title': 'Configuration du point d’accès Wi-Fi…',
|
||||
'setup_step2_wifi_desc': 'Application des paramètres SSID, sécurité et interface réseau…',
|
||||
'setup_step3_vpn_title': 'Enregistrement des profils VPN…',
|
||||
'setup_step4_notif_title': 'Enregistrement des alertes et notifications…',
|
||||
'setup_step5_prefs_title': 'Finalisation des préférences, mises à jour & sauvegardes…',
|
||||
'setup_step5_prefs_desc': 'Enregistrement du thème, du titre, de la mise à jour auto et des sauvegardes…',
|
||||
'setup_launch_success_title': '✅ Configuration réussie !',
|
||||
'setup_launch_redirecting': 'Redirection vers le tableau de bord…',
|
||||
|
||||
'modal_backup_title': 'Restauration d\'une sauvegarde',
|
||||
'modal_backup_desc': 'Sélectionnez les éléments de la sauvegarde que vous souhaitez restaurer dans le système :',
|
||||
@@ -3464,6 +3562,27 @@
|
||||
'recap_auto_start_no': 'Autostart: No',
|
||||
'btn_modify_settings': '← Modify Settings',
|
||||
'btn_submit_setup': '🚀 Save and Start AP',
|
||||
'setup_launch_modal_title': 'Initial Setup & Startup',
|
||||
'setup_launch_badge': 'Setup in progress…',
|
||||
'setup_launch_badge_complete': 'Setup complete!',
|
||||
'setup_step_label': 'Step {step} / 5',
|
||||
'setup_launch_starting': 'Starting setup process…',
|
||||
'setup_launch_details': 'Initializing services and validating data…',
|
||||
'setup_step1_admin': 'Administrator account & session creation',
|
||||
'setup_step2_wifi': 'Wi-Fi Access Point configuration & startup',
|
||||
'setup_step3_vpn': 'VPN profiles configuration',
|
||||
'setup_step4_notif': 'Alert events & notification settings',
|
||||
'setup_step5_prefs': 'Preferences, updates & backup schedules',
|
||||
'setup_step1_admin_title': 'Creating administrator account…',
|
||||
'setup_step1_admin_desc': 'Securing credentials and initializing session…',
|
||||
'setup_step2_wifi_title': 'Configuring Wi-Fi Access Point…',
|
||||
'setup_step2_wifi_desc': 'Applying SSID, security and network interfaces…',
|
||||
'setup_step3_vpn_title': 'Configuring VPN profiles…',
|
||||
'setup_step4_notif_title': 'Saving alert events & notifications…',
|
||||
'setup_step5_prefs_title': 'Finalizing preferences, updates & backups…',
|
||||
'setup_step5_prefs_desc': 'Saving theme, application title, update interval and backup schedule…',
|
||||
'setup_launch_success_title': '✅ AP Manageur configured successfully!',
|
||||
'setup_launch_redirecting': 'Redirecting to dashboard…',
|
||||
|
||||
'modal_backup_title': 'Restore Backup',
|
||||
'modal_backup_desc': 'Select the components from your backup file that you wish to restore:',
|
||||
@@ -3660,6 +3779,27 @@
|
||||
'recap_auto_start_no': 'Autostart: No',
|
||||
'btn_modify_settings': '← Modify Settings',
|
||||
'btn_submit_setup': '🚀 Save and Start AP',
|
||||
'setup_launch_modal_title': 'Initial Setup & Startup',
|
||||
'setup_launch_badge': 'Setup in progress…',
|
||||
'setup_launch_badge_complete': 'Setup complete!',
|
||||
'setup_step_label': 'Step {step} / 5',
|
||||
'setup_launch_starting': 'Starting setup process…',
|
||||
'setup_launch_details': 'Initializing services and validating data…',
|
||||
'setup_step1_admin': 'Administrator account & session creation',
|
||||
'setup_step2_wifi': 'Wi-Fi Access Point configuration & startup',
|
||||
'setup_step3_vpn': 'VPN profiles configuration',
|
||||
'setup_step4_notif': 'Alert events & notification settings',
|
||||
'setup_step5_prefs': 'Preferences, updates & backup schedules',
|
||||
'setup_step1_admin_title': 'Creating administrator account…',
|
||||
'setup_step1_admin_desc': 'Securing credentials and initializing session…',
|
||||
'setup_step2_wifi_title': 'Configuring Wi-Fi Access Point…',
|
||||
'setup_step2_wifi_desc': 'Applying SSID, security and network interfaces…',
|
||||
'setup_step3_vpn_title': 'Configuring VPN profiles…',
|
||||
'setup_step4_notif_title': 'Saving alert events & notifications…',
|
||||
'setup_step5_prefs_title': 'Finalizing preferences, updates & backups…',
|
||||
'setup_step5_prefs_desc': 'Saving theme, application title, update interval and backup schedule…',
|
||||
'setup_launch_success_title': '✅ AP Manageur configured successfully!',
|
||||
'setup_launch_redirecting': 'Redirecting to dashboard…',
|
||||
|
||||
'modal_backup_title': 'Restore Backup',
|
||||
'modal_backup_desc': 'Select the components from your backup file that you wish to restore:',
|
||||
@@ -5764,19 +5904,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
function closeSetupStartProgressModal() {
|
||||
const modal = $('modalSetupStartProgress');
|
||||
if (modal) modal.style.display = 'none';
|
||||
isConfiguring = false;
|
||||
const btn = $('btnSubmitSetup');
|
||||
const btnBack = $('btnBackTo5');
|
||||
if (btn) {
|
||||
btn.disabled = false;
|
||||
btn.style.opacity = '';
|
||||
}
|
||||
if (btnBack) btnBack.disabled = false;
|
||||
}
|
||||
|
||||
async function submitSetup() {
|
||||
if (isConfiguring) return;
|
||||
|
||||
const msg = $('setupMessage');
|
||||
const btn = $('btnSubmitSetup');
|
||||
const btnBack = $('btnBackTo5');
|
||||
const progBox = $('setupProgressContainer');
|
||||
const progBar = $('setupProgressBar');
|
||||
const isEn = currentLanguage.startsWith('en');
|
||||
|
||||
msg.textContent = '';
|
||||
msg.style.color = 'var(--muted)';
|
||||
|
||||
const ssid = $('setupSsid') ? $('setupSsid').value.trim() : '';
|
||||
const password = $('setupPassword') ? $('setupPassword').value : '';
|
||||
const confirmation = $('setupPasswordConfirm') ? $('setupPasswordConfirm').value : '';
|
||||
@@ -5797,17 +5944,86 @@
|
||||
if (notifSt.anyChecked && !notifSt.ready) { goToStep(4); return validateStep4(); }
|
||||
|
||||
isConfiguring = true;
|
||||
btn.disabled = true;
|
||||
if (btn) {
|
||||
btn.disabled = true;
|
||||
btn.style.opacity = '0.7';
|
||||
}
|
||||
if (btnBack) btnBack.disabled = true;
|
||||
btn.style.opacity = '0.7';
|
||||
|
||||
if (progBox) progBox.style.display = 'block';
|
||||
if (progBar) progBar.style.width = '20%';
|
||||
// Affichage de la fenêtre modale de progression (même style que la restauration)
|
||||
const modal = $('modalSetupStartProgress');
|
||||
if (modal) modal.style.display = 'flex';
|
||||
if ($('setupStartErrorBox')) $('setupStartErrorBox').style.display = 'none';
|
||||
if ($('setupStartIcon')) {
|
||||
$('setupStartIcon').textContent = '🚀';
|
||||
$('setupStartIcon').style.animation = 'iconFloat 2s ease-in-out infinite';
|
||||
}
|
||||
if ($('setupStartBadgeIcon')) {
|
||||
$('setupStartBadgeIcon').textContent = '⚙️';
|
||||
$('setupStartBadgeIcon').style.animation = 'spin 1.5s linear infinite';
|
||||
}
|
||||
if ($('setupStartBadgeText')) {
|
||||
$('setupStartBadgeText').textContent = t('setup_launch_badge', 'Configuration en cours…');
|
||||
}
|
||||
|
||||
function updateSetupModalStep(stepIdx, pct, statusText, detailsText, isError = false) {
|
||||
if ($('setupStartProgressBar')) $('setupStartProgressBar').style.width = pct + '%';
|
||||
if ($('setupStartPercent')) $('setupStartPercent').textContent = pct + '%';
|
||||
if ($('setupStartStepLabel')) {
|
||||
const tmpl = t('setup_step_label', isEn ? 'Étape {step} / 5' : 'Étape {step} / 5');
|
||||
$('setupStartStepLabel').textContent = tmpl.replace('{step}', String(stepIdx));
|
||||
}
|
||||
if (statusText && $('setupStartStatusText')) {
|
||||
$('setupStartStatusText').style.color = isError ? 'var(--red)' : 'var(--text)';
|
||||
$('setupStartStatusText').textContent = statusText;
|
||||
}
|
||||
if (detailsText && $('setupStartDetails')) $('setupStartDetails').textContent = detailsText;
|
||||
|
||||
const steps = [
|
||||
{ id: 'setupStepAdmin', stateId: 'setupStepAdminState' },
|
||||
{ id: 'setupStepWifi', stateId: 'setupStepWifiState' },
|
||||
{ id: 'setupStepVpn', stateId: 'setupStepVpnState' },
|
||||
{ id: 'setupStepNotif', stateId: 'setupStepNotifState' },
|
||||
{ id: 'setupStepPrefs', stateId: 'setupStepPrefsState' }
|
||||
];
|
||||
|
||||
steps.forEach((s, idx) => {
|
||||
const el = $(s.id);
|
||||
const st = $(s.stateId);
|
||||
if (!el || !st) return;
|
||||
const num = idx + 1;
|
||||
if (num < stepIdx) {
|
||||
el.className = 'loader-step done';
|
||||
el.style.borderColor = 'rgba(34, 197, 94, 0.3)';
|
||||
st.textContent = '✓';
|
||||
st.style.color = 'var(--green)';
|
||||
} else if (num === stepIdx) {
|
||||
if (isError) {
|
||||
el.className = 'loader-step';
|
||||
el.style.borderColor = 'rgba(239, 68, 68, 0.4)';
|
||||
st.textContent = '❌';
|
||||
st.style.color = 'var(--red)';
|
||||
} else {
|
||||
el.className = 'loader-step active';
|
||||
el.style.borderColor = 'rgba(56, 189, 248, 0.4)';
|
||||
st.textContent = '↻';
|
||||
st.style.color = 'var(--blue)';
|
||||
}
|
||||
} else {
|
||||
el.className = 'loader-step';
|
||||
el.style.borderColor = 'transparent';
|
||||
st.textContent = '⏳';
|
||||
st.style.color = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// A. Création du compte administrateur
|
||||
msg.textContent = isEn ? '1/5 Creating administrator account…' : '1/5 Création du compte administrateur…';
|
||||
if (progBar) progBar.style.width = '25%';
|
||||
// Étape 1 : Création du compte administrateur & session
|
||||
updateSetupModalStep(1, 20,
|
||||
t('setup_step1_admin_title', isEn ? 'Creating administrator account…' : 'Création du compte administrateur…'),
|
||||
t('setup_step1_admin_desc', isEn ? 'Securing credentials and initializing session…' : 'Sécurisation des identifiants et création de la session…')
|
||||
);
|
||||
|
||||
const rAdmin = await fetch(API_URL + '/api/auth/setup', {
|
||||
method: 'POST',
|
||||
@@ -5816,10 +6032,9 @@
|
||||
});
|
||||
const dAdmin = await rAdmin.json();
|
||||
if (!rAdmin.ok && !dAdmin.message?.includes('déjà')) {
|
||||
throw new Error(dAdmin.error || 'Erreur lors de la création du compte');
|
||||
throw new Error(dAdmin.error || (isEn ? 'Error creating administrator account' : 'Erreur lors de la création du compte'));
|
||||
}
|
||||
|
||||
// B. Connexion pour obtenir le jeton de session
|
||||
let token = '';
|
||||
try {
|
||||
const rLog = await fetch(API_URL + '/api/login', {
|
||||
@@ -5840,9 +6055,11 @@
|
||||
|
||||
const headers = getSetupAuthHeaders(token, true);
|
||||
|
||||
// C. Configuration du réseau Wi-Fi
|
||||
msg.textContent = isEn ? '2/5 Configuring Wi-Fi Access Point…' : '2/5 Configuration du point d\'accès Wi-Fi…';
|
||||
if (progBar) progBar.style.width = '45%';
|
||||
// Étape 2 : Configuration du point d'accès Wi-Fi
|
||||
updateSetupModalStep(2, 40,
|
||||
t('setup_step2_wifi_title', isEn ? 'Configuring Wi-Fi Access Point…' : 'Configuration du point d’accès Wi-Fi…'),
|
||||
t('setup_step2_wifi_desc', isEn ? 'Applying SSID, security and network interfaces…' : 'Application des paramètres SSID, sécurité et interface réseau…')
|
||||
);
|
||||
|
||||
const rSetup = await fetch(API_URL + '/api/setup', {
|
||||
method: 'POST',
|
||||
@@ -5857,12 +6074,17 @@
|
||||
})
|
||||
});
|
||||
const dSetup = await rSetup.json();
|
||||
if (!rSetup.ok) throw new Error(dSetup.error || 'Erreur lors de la configuration du Wi-Fi');
|
||||
if (!rSetup.ok) throw new Error(dSetup.error || (isEn ? 'Error configuring Wi-Fi network' : 'Erreur lors de la configuration du Wi-Fi'));
|
||||
|
||||
// Étape 3 : Profils VPN (si configurés)
|
||||
updateSetupModalStep(3, 60,
|
||||
t('setup_step3_vpn_title', isEn ? 'Configuring VPN profiles…' : 'Enregistrement des profils VPN…'),
|
||||
setupVpnProfiles.length
|
||||
? (isEn ? `Registering ${setupVpnProfiles.length} VPN profile(s)…` : `Enregistrement de ${setupVpnProfiles.length} profil(s) VPN…`)
|
||||
: (isEn ? 'No VPN profile configured (skipping)…' : 'Aucun profil VPN à enregistrer…')
|
||||
);
|
||||
|
||||
// D. Enregistrement des profils VPN (si ajoutés en Étape 5)
|
||||
if (setupVpnProfiles.length) {
|
||||
msg.textContent = isEn ? '3/5 Saving VPN profiles…' : '3/5 Enregistrement des profils VPN…';
|
||||
if (progBar) progBar.style.width = '65%';
|
||||
for (const p of setupVpnProfiles) {
|
||||
try {
|
||||
await fetch(API_URL + '/api/vpn/profiles', {
|
||||
@@ -5883,10 +6105,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// E. Enregistrement des notifications (si au moins un service configuré et testé)
|
||||
// Étape 4 : Notifications & Alertes (si configurées)
|
||||
updateSetupModalStep(4, 80,
|
||||
t('setup_step4_notif_title', isEn ? 'Saving alert events & notifications…' : 'Enregistrement des alertes et notifications…'),
|
||||
notifSt.ready
|
||||
? (isEn ? 'Configuring delivery channels and alert triggers…' : 'Configuration des canaux d’envoi et déclencheurs d’alerte…')
|
||||
: (isEn ? 'No notification channel configured (skipping)…' : 'Aucun canal de notification à enregistrer…')
|
||||
);
|
||||
|
||||
if (notifSt.ready) {
|
||||
msg.textContent = isEn ? '4/5 Saving notification channels & alert events…' : '4/5 Enregistrement des alertes et notifications…';
|
||||
if (progBar) progBar.style.width = '80%';
|
||||
try {
|
||||
const notifPayload = getNotificationFormPayload();
|
||||
await fetch(API_URL + '/api/notifications/settings', {
|
||||
@@ -5897,9 +6124,12 @@
|
||||
} catch (_) { }
|
||||
}
|
||||
|
||||
// F. Enregistrement des préférences (Thème, langue, nom)
|
||||
msg.textContent = isEn ? '5/5 Finalizing preferences…' : '5/5 Finalisation des préférences…';
|
||||
if (progBar) progBar.style.width = '95%';
|
||||
// Étape 5 : Préférences, recherche de mise à jour & planification des sauvegardes
|
||||
updateSetupModalStep(5, 95,
|
||||
t('setup_step5_prefs_title', isEn ? 'Finalizing preferences, updates & backups…' : 'Finalisation des préférences, mises à jour & sauvegardes…'),
|
||||
t('setup_step5_prefs_desc', isEn ? 'Saving theme, application title, update interval and backup schedule…' : 'Enregistrement du thème, du titre, de la mise à jour auto et des sauvegardes…')
|
||||
);
|
||||
|
||||
try {
|
||||
await fetch(API_URL + '/api/preferences', {
|
||||
method: 'POST',
|
||||
@@ -5913,7 +6143,6 @@
|
||||
});
|
||||
} catch (_) { }
|
||||
|
||||
// G. Enregistrement recherche de mise à jour & planification des sauvegardes
|
||||
try {
|
||||
const updEnabled = $('setupUpdateCheckerEnabled') ? $('setupUpdateCheckerEnabled').checked : true;
|
||||
const updInterval = $('setupUpdateInterval') ? parseInt($('setupUpdateInterval').value, 10) : 1800;
|
||||
@@ -5945,22 +6174,73 @@
|
||||
});
|
||||
} catch (_) { }
|
||||
|
||||
if (progBar) progBar.style.width = '100%';
|
||||
msg.style.color = 'var(--green)';
|
||||
msg.textContent = isEn ? '✅ Configuration complete! Redirecting to dashboard…' : '✅ Configuration réussie ! Redirection vers le tableau de bord…';
|
||||
// Succès complet !
|
||||
if ($('setupStartProgressBar')) $('setupStartProgressBar').style.width = '100%';
|
||||
if ($('setupStartPercent')) $('setupStartPercent').textContent = '100%';
|
||||
if ($('setupStartIcon')) {
|
||||
$('setupStartIcon').textContent = '✅';
|
||||
$('setupStartIcon').style.animation = 'none';
|
||||
}
|
||||
if ($('setupStartBadgeIcon')) {
|
||||
$('setupStartBadgeIcon').textContent = '✅';
|
||||
$('setupStartBadgeIcon').style.animation = 'none';
|
||||
}
|
||||
if ($('setupStartBadgeText')) {
|
||||
$('setupStartBadgeText').textContent = t('setup_launch_badge_complete', isEn ? 'Setup complete!' : 'Configuration réussie !');
|
||||
}
|
||||
if ($('setupStartStatusText')) {
|
||||
$('setupStartStatusText').style.color = 'var(--green)';
|
||||
$('setupStartStatusText').textContent = t('setup_launch_success_title', isEn ? '✅ AP Manageur configured successfully!' : '✅ Configuration réussie !');
|
||||
}
|
||||
if ($('setupStartDetails')) {
|
||||
$('setupStartDetails').textContent = t('setup_launch_redirecting', isEn ? 'Redirecting to dashboard…' : 'Redirection vers le tableau de bord…');
|
||||
}
|
||||
|
||||
// Marquer toutes les 5 étapes à 'done'
|
||||
['setupStepAdmin', 'setupStepWifi', 'setupStepVpn', 'setupStepNotif', 'setupStepPrefs'].forEach((id, idx) => {
|
||||
const el = $(id);
|
||||
const st = $(['setupStepAdminState', 'setupStepWifiState', 'setupStepVpnState', 'setupStepNotifState', 'setupStepPrefsState'][idx]);
|
||||
if (el && st) {
|
||||
el.className = 'loader-step done';
|
||||
el.style.borderColor = 'rgba(34, 197, 94, 0.3)';
|
||||
st.textContent = '✓';
|
||||
st.style.color = 'var(--green)';
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
location.href = '/';
|
||||
}, 1200);
|
||||
|
||||
} catch (err) {
|
||||
msg.style.color = 'var(--red)';
|
||||
msg.textContent = '❌ ' + (err.message || 'Une erreur est survenue');
|
||||
if ($('setupStartIcon')) {
|
||||
$('setupStartIcon').textContent = '❌';
|
||||
$('setupStartIcon').style.animation = 'none';
|
||||
}
|
||||
if ($('setupStartBadgeIcon')) {
|
||||
$('setupStartBadgeIcon').textContent = '⚠️';
|
||||
$('setupStartBadgeIcon').style.animation = 'none';
|
||||
}
|
||||
if ($('setupStartBadgeText')) {
|
||||
$('setupStartBadgeText').textContent = isEn ? 'Error' : 'Échec';
|
||||
}
|
||||
if ($('setupStartStatusText')) {
|
||||
$('setupStartStatusText').style.color = 'var(--red)';
|
||||
$('setupStartStatusText').textContent = isEn ? 'Configuration stopped' : 'La configuration a rencontré une erreur';
|
||||
}
|
||||
if ($('setupStartDetails')) {
|
||||
$('setupStartDetails').textContent = err.message || (isEn ? 'An unexpected error occurred' : 'Une erreur inattendue est survenue');
|
||||
}
|
||||
if ($('setupStartErrorBox')) {
|
||||
$('setupStartErrorBox').style.display = 'block';
|
||||
if ($('setupStartErrorText')) $('setupStartErrorText').textContent = '❌ ' + (err.message || 'Une erreur est survenue');
|
||||
}
|
||||
isConfiguring = false;
|
||||
btn.disabled = false;
|
||||
if (btn) {
|
||||
btn.disabled = false;
|
||||
btn.style.opacity = '';
|
||||
}
|
||||
if (btnBack) btnBack.disabled = false;
|
||||
btn.style.opacity = '';
|
||||
if (progBox) progBox.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user