forked from snxraven/LinkUp-P2P-Chat
parent
8c0f7ebd0f
commit
de9e01e932
26
app.js
26
app.js
@ -61,30 +61,18 @@ function updatePeerCount() {
|
||||
}
|
||||
}
|
||||
|
||||
async function processGuild(guildTopic) {
|
||||
// Simulate fetching guild data for the given topic
|
||||
const guildData = {
|
||||
guildTopic,
|
||||
guildAlias: "Sample Guild",
|
||||
rooms: [
|
||||
{ topic: "room1", alias: "Room 1" },
|
||||
{ topic: "room2", alias: "Room 2" }
|
||||
],
|
||||
owner: config.userName
|
||||
};
|
||||
|
||||
config.guilds[guildData.guildTopic] = {
|
||||
alias: guildData.guildAlias,
|
||||
rooms: guildData.rooms,
|
||||
owner: guildData.owner
|
||||
async function processGuild(guildData) {
|
||||
const parsedData = JSON.parse(guildData);
|
||||
config.guilds[parsedData.guildTopic] = {
|
||||
alias: parsedData.guildAlias,
|
||||
rooms: parsedData.rooms,
|
||||
owner: parsedData.owner
|
||||
};
|
||||
writeConfigToFile("./config.json");
|
||||
renderGuildList();
|
||||
await joinGuild(guildData.guildTopic);
|
||||
await joinGuild(parsedData.guildTopic);
|
||||
}
|
||||
|
||||
export { processGuild };
|
||||
|
||||
async function joinGuild(guildTopic) {
|
||||
const guild = config.guilds[guildTopic];
|
||||
if (guild) {
|
||||
|
@ -103,9 +103,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
import { processGuild } from './app.js';
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const messageInput = document.getElementById('message');
|
||||
const copyTopicLink = document.getElementById('copy-topic-link');
|
||||
@ -256,4 +254,4 @@
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user