From 0077989253a5d956372f174904b104718db50b98 Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Sun, 9 Jun 2024 10:08:29 +0300 Subject: [PATCH] It acutally works just fine now yay --- app.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 9a3dd18..8ceceb6 100644 --- a/app.js +++ b/app.js @@ -100,7 +100,7 @@ async function initialize() { config = JSON.parse(fs.readFileSync("./config.json", 'utf8')); console.log("Read config from file:", config) config.rooms.forEach(room => { - addRoomToList(room); + addRoomToListWithoutWritingToConfig(room); }); } @@ -252,6 +252,15 @@ function addRoomToList(topic) { writeConfigToFile("./config.json"); } +function addRoomToListWithoutWritingToConfig(topic) { + const roomList = document.querySelector('#room-list'); + const roomItem = document.createElement('li'); + roomItem.textContent = truncateHash(topic); + roomItem.dataset.topic = topic; + roomItem.addEventListener('click', () => switchRoom(topic)); + roomList.appendChild(roomItem); +} + function switchRoom(topic) { const topicBuffer = b4a.from(topic, 'hex'); joinSwarm(topicBuffer);