From d423031cfbf544aa8a95f110b2434b6f21824a2c Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Sun, 7 Jul 2024 21:14:17 -0400 Subject: [PATCH] more test --- app.js | 19 ++++++++++++++++++- index.html | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 64a846c..83dacd1 100644 --- a/app.js +++ b/app.js @@ -351,6 +351,8 @@ function handleIncomingMessage(messageObj) { peer.write(renameMessage); } } + + } } } else if (messageObj.type === 'guildJoin') { @@ -361,7 +363,22 @@ function handleIncomingMessage(messageObj) { renderGuildList(); joinGuild(guildTopic); } - } else { + } else if (messageObj.type === 'guildRequest') { + const guildTopic = messageObj.guildTopic; + const guild = config.guilds[guildTopic]; + if (guild) { + const guildResponseMessage = JSON.stringify({ + type: 'guildResponse', + guildData: JSON.stringify({ + guildTopic, + guildAlias: guild.alias, + rooms: guild.rooms, + owner: guild.owner + }) + }); + connection.write(guildResponseMessage); + } + } else { console.error('Received unknown message type:', messageObj); } } diff --git a/index.html b/index.html index 8f539cb..6d89123 100644 --- a/index.html +++ b/index.html @@ -185,7 +185,7 @@ joinGuildBtn.addEventListener('click', async (event) => { const guildTopic = document.getElementById('join-guild-topic').value.trim(); if (guildTopic) { - await processGuild(guildTopic); + await joinGuildRequest(guildTopic); } }); @@ -254,4 +254,4 @@ } - \ No newline at end of file +