From a3fbe7434a654d409b4c47f10ecb35de3b0c0cb0 Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Sun, 9 Jun 2024 09:50:05 +0300 Subject: [PATCH] Hmm will it work this way? --- app.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index dc224a3..3be3a05 100644 --- a/app.js +++ b/app.js @@ -95,13 +95,16 @@ async function initialize() { }); } - readConfigFromFile(); - config.rooms.forEach(room => { - addRoomToList(room); - }); + const configExists = fs.existsSync("./config.json"); + if (configExists) { + readConfigFromFile(); + config.rooms.forEach(room => { + addRoomToList(room); + }); + } const registerDiv = document.querySelector('#register'); - if (registerDiv && config.userName !== '') { + if (registerDiv && !configExists) { registerDiv.classList.remove('hidden'); }