From 3cdad516c9afaa90b055ab7bf114ede4bdc99191 Mon Sep 17 00:00:00 2001 From: Sandro642 Date: Sat, 26 Oct 2024 16:26:54 +0200 Subject: [PATCH] Add debug mode option to Athena's Shield configuration Introduced an option to activate debug mode in Athena's Shield. Updated relevant JavaScript files and configuration to handle the debug mode setting. Added a new method for retrieving the debug status within the parserAthShield.js class. --- app/assets/athshield/athshield.js | 47 +++++++++++++----------- app/assets/athshield/parserAthShield.js | 5 +++ app/assets/athshield/variables.athshield | 3 +- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/assets/athshield/athshield.js b/app/assets/athshield/athshield.js index e6dc1475..15b7764c 100644 --- a/app/assets/athshield/athshield.js +++ b/app/assets/athshield/athshield.js @@ -37,33 +37,38 @@ function startCLI() { if (answer.toLowerCase() === 'yes') { config.athenaShieldActivated = true - rl.question('Would you like to hide or block the menu? (hide/block): ', (menuAnswer) => { - if (menuAnswer.trim().startsWith('//')) { - console.log('This is a comment; the line is ignored.') - rl.close() - return - } + rl.question('Would you like to activate debug mode? (yes/no): ', (debugAnswer) => { + config.debug = debugAnswer.toLowerCase() === 'yes' // Set debug to true or false - if (menuAnswer.toLowerCase() === 'hide') { - config.menuVisibility = 'hidden' // Change to 'hidden' - console.log('Athena\'s Shield activated. Menu hidden.') - } else if (menuAnswer.toLowerCase() === 'block') { - config.menuVisibility = 'blocked' // Change to 'blocked' - console.log('Athena\'s Shield activated. Menu blocked.') - } else { - console.log('Invalid option for the menu.') - rl.close() - return - } + rl.question('Would you like to hide or block the menu? (hide/block): ', (menuAnswer) => { + if (menuAnswer.trim().startsWith('//')) { + console.log('This is a comment; the line is ignored.') + rl.close() + return + } - // Save the modified configuration - saveConfig(config) - rl.close() + if (menuAnswer.toLowerCase() === 'hide') { + config.menuVisibility = 'hidden' // Set to 'hidden' + console.log('Athena\'s Shield activated. Menu hidden.') + } else if (menuAnswer.toLowerCase() === 'block') { + config.menuVisibility = 'blocked' // Set to 'blocked' + console.log('Athena\'s Shield activated. Menu blocked.') + } else { + console.log('Invalid option for the menu.') + rl.close() + return + } + + // Save the modified configuration + saveConfig(config) + rl.close() + }) }) } else if (answer.toLowerCase() === 'no') { console.log('Athena\'s Shield not activated. Closing the CLI.') config.athenaShieldActivated = false - config.menuVisibility = 'visible' // Reset to default value + config.menuVisibility = 'visible' // Reset to default + config.debug = 'false' // Save the modified configuration saveConfig(config) diff --git a/app/assets/athshield/parserAthShield.js b/app/assets/athshield/parserAthShield.js index de3c9a6c..336e0d4f 100644 --- a/app/assets/athshield/parserAthShield.js +++ b/app/assets/athshield/parserAthShield.js @@ -25,6 +25,11 @@ class AthenaShield { get type() { return this.config.menuVisibility } + + // Récupérer le mode debug + get debug() { + return this.config.debug + } } // Exporter une instance de la classe diff --git a/app/assets/athshield/variables.athshield b/app/assets/athshield/variables.athshield index 19610b1f..b7c29b1a 100644 --- a/app/assets/athshield/variables.athshield +++ b/app/assets/athshield/variables.athshield @@ -1,4 +1,5 @@ { "athenaShieldActivated": false, - "menuVisibility": "visible" + "menuVisibility": "visible", + "debug": "false" } \ No newline at end of file