diff --git a/setup.html b/setup.html
index f57eae7..57048a9 100644
--- a/setup.html
+++ b/setup.html
@@ -1909,12 +1909,15 @@
ultérieurement depuis le tableau de bord.
+
-
-
@@ -2774,6 +2777,7 @@
renderSetupVpnList();
updateStatsReportCronFromFields();
+ if (typeof updateStep4ContinueState === 'function') updateStep4ContinueState();
if (currentStep === 6) {
updateRecap();
@@ -2802,6 +2806,7 @@
toggleNotifFields();
initStatsReportTimeSelects();
}
+ updateStep4ContinueState();
}
function selectSetupNotifSubTab(tab) {
@@ -2831,6 +2836,7 @@
const f = $('notif' + cap + 'Fields');
if (f) f.style.display = en ? 'block' : 'none';
});
+ updateStep4ContinueState();
}
function toggleStatsReportSchedule(isEn) {
@@ -3407,6 +3413,14 @@
function goToStep(stepNum) {
if (stepNum < 1 || stepNum > 6) return;
+ if (currentStep === 4 && stepNum > 4) {
+ const st = getStep4NotificationStatus();
+ if (st.enabled && !st.anyConfigured) {
+ updateStep4ContinueState();
+ selectSetupNotifSubTab('services');
+ return;
+ }
+ }
currentStep = stepNum;
maxStepReached = Math.max(maxStepReached, stepNum);
@@ -3497,6 +3511,76 @@
goToStep(4);
}
+ function getStep4NotificationStatus() {
+ const notifOn = !!($('notifEnabledSwitch') && $('notifEnabledSwitch').checked);
+ if (!notifOn) return { enabled: false, anyChecked: false, anyConfigured: false };
+ const p = getNotificationFormPayload();
+ const checks = [
+ { en: p.email.enabled, ok: !!(p.email.smtp_host && p.email.to_addr) },
+ { en: p.gotify.enabled, ok: !!(p.gotify.server_url && p.gotify.token) },
+ { en: p.discord.enabled, ok: !!p.discord.webhook_url },
+ { en: p.ntfy.enabled, ok: !!(p.ntfy.server_url && p.ntfy.topic) },
+ { en: p.pushbullet.enabled, ok: !!p.pushbullet.api_token },
+ { en: p.pushover.enabled, ok: !!(p.pushover.user_key && p.pushover.api_token) },
+ { en: p.slack.enabled, ok: !!p.slack.webhook_url },
+ { en: p.telegram.enabled, ok: !!(p.telegram.bot_token && p.telegram.chat_id) },
+ { en: p.webhook.enabled, ok: !!p.webhook.url }
+ ];
+ return {
+ enabled: true,
+ anyChecked: checks.some(c => c.en),
+ anyConfigured: checks.some(c => c.en && c.ok)
+ };
+ }
+
+ function updateStep4ContinueState() {
+ const btn = $('btnStep4Continue');
+ const errEl = $('step4Error');
+ const st = getStep4NotificationStatus();
+ const isEn = currentLanguage.startsWith('en');
+
+ if (st.enabled && !st.anyConfigured) {
+ if (btn) {
+ btn.disabled = true;
+ btn.style.opacity = '0.5';
+ btn.style.cursor = 'not-allowed';
+ }
+ const msg = st.anyChecked
+ ? (isEn
+ ? '⚠️ Please fill in the required fields for the enabled notification service (URL, token, recipient...) or disable automatic notifications to continue.'
+ : '⚠️ Veuillez compléter les champs obligatoires du service de notification activé (URL, jeton, destinataire...) ou désactiver les notifications automatiques pour continuer.')
+ : (isEn
+ ? '⚠️ Please enable and configure at least one notification service (or disable automatic notifications) to continue.'
+ : '⚠️ Veuillez activer et configurer au moins un service de notification (ou désactiver les notifications automatiques) pour continuer.');
+ showError(errEl, msg);
+ } else {
+ if (btn) {
+ btn.disabled = false;
+ btn.style.opacity = '';
+ btn.style.cursor = '';
+ }
+ if (errEl) errEl.style.display = 'none';
+ }
+ }
+
+ function skipStep4() {
+ if ($('notifEnabledSwitch')) {
+ $('notifEnabledSwitch').checked = false;
+ onNotifToggle();
+ }
+ goToStep(5);
+ }
+
+ function validateStep4() {
+ updateStep4ContinueState();
+ const st = getStep4NotificationStatus();
+ if (st.enabled && !st.anyConfigured) {
+ selectSetupNotifSubTab('services');
+ return;
+ }
+ goToStep(5);
+ }
+
function showError(el, msg) {
if (!el) return;
el.textContent = msg;
@@ -3658,6 +3742,12 @@
setSetupTheme(currentTheme);
initStatsReportTimeSelects();
loadNotificationSettingsInSetup();
+ const notifBox = $('notifChannelsBox');
+ if (notifBox) {
+ notifBox.addEventListener('input', updateStep4ContinueState);
+ notifBox.addEventListener('change', updateStep4ContinueState);
+ }
+ updateStep4ContinueState();
// 1. Vérification du statut d'authentification et de configuration
try {
@@ -3718,6 +3808,8 @@
if (!ssid) { goToStep(2); return validateStep2(); }
if (!password || password !== confirmation) { goToStep(2); return validateStep2(); }
if (!adminUser || !adminPass) { goToStep(3); return validateStep3(); }
+ const notifSt = getStep4NotificationStatus();
+ if (notifSt.enabled && !notifSt.anyConfigured) { goToStep(4); return validateStep4(); }
isConfiguring = true;
btn.disabled = true;