From 96e0ca12f493ae61ed4d8ea4fb2d652c1e48629e Mon Sep 17 00:00:00 2001 From: Sandro642 Date: Thu, 24 Oct 2024 18:17:46 +0200 Subject: [PATCH] Refactor menu visibility logic in athshield.js Separate logic for 'cacher' and 'bloquer' options and update corresponding values to 'hidden' and 'blocked' respectively. Ensure configuration is saved after setting the menu visibility. --- app/assets/athshield/athshield.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/assets/athshield/athshield.js b/app/assets/athshield/athshield.js index 429fd900..f2a3d0a6 100644 --- a/app/assets/athshield/athshield.js +++ b/app/assets/athshield/athshield.js @@ -44,17 +44,21 @@ function startCLI() { return } - if (menuAnswer.toLowerCase() === 'cacher' || menuAnswer.toLowerCase() === 'bloquer') { - config.menuVisibility = menuAnswer.toLowerCase() - console.log(`Athena's Shield activé. Menu ${config.menuVisibility === 'cacher' ? 'caché' : 'bloqué'}.`) - - // Sauvegarder la configuration modifiée - saveConfig(config) - rl.close() + if (menuAnswer.toLowerCase() === 'cacher') { + config.menuVisibility = 'hidden' // Change to 'hidden' + console.log(`Athena's Shield activé. Menu caché.`) + } else if (menuAnswer.toLowerCase() === 'bloquer') { + config.menuVisibility = 'blocked' // Change to 'blocked' + console.log(`Athena's Shield activé. Menu bloqué.`) } else { console.log('Option non valide pour le menu.') rl.close() + return } + + // Sauvegarder la configuration modifiée + saveConfig(config) + rl.close() }) } else if (answer.toLowerCase() === 'non') { console.log('Athena\'s Shield non activé. Fermeture du CLI.')