forked from snxraven/LinkUp-P2P-Chat
Compare commits
No commits in common. "33e0a13f93eb38deeb8ebad974a6274b459a58c8" and "72bf632cd4efb6c25d2c129198927c87d2af38be" have entirely different histories.
33e0a13f93
...
72bf632cd4
10
app.js
10
app.js
@ -278,15 +278,14 @@ function leaveRoom() {
|
||||
if (roomItem) {
|
||||
roomItem.remove();
|
||||
}
|
||||
|
||||
config.rooms = config.rooms.filter(e => e !== currentRoom.topic);
|
||||
writeConfigToFile("./config.json");
|
||||
|
||||
currentRoom.destroy();
|
||||
currentRoom = null;
|
||||
}
|
||||
document.querySelector('#chat').classList.add('hidden');
|
||||
document.querySelector('#setup').classList.remove('hidden');
|
||||
|
||||
config.rooms = config.rooms.filter(e => e !== currentRoom.topic);
|
||||
writeConfigToFile("./config.json");
|
||||
}
|
||||
|
||||
function sendMessage(e) {
|
||||
@ -302,9 +301,7 @@ function sendMessage(e) {
|
||||
message,
|
||||
avatar: config.userAvatar,
|
||||
topic: b4a.toString(currentRoom.topic, 'hex'),
|
||||
peers: [...swarm.connections].map(peer => peer.remotePublicKey.toString('hex')),
|
||||
timestamp: Date.now(),
|
||||
readableTimestamp: new Date().toLocaleString(), // Added human-readable timestamp
|
||||
});
|
||||
|
||||
const peers = [...swarm.connections];
|
||||
@ -441,6 +438,7 @@ function toggleSetupView() {
|
||||
}
|
||||
|
||||
function writeConfigToFile(filePath) {
|
||||
console.debug(config)
|
||||
fs.writeFile(filePath, JSON.stringify(config), (err) => {
|
||||
if (err) return console.error(err);
|
||||
console.log("File has been created");
|
||||
|
Loading…
Reference in New Issue
Block a user