improve ergonomy

This commit is contained in:
2025-03-10 17:27:25 +01:00
parent 874aeb8897
commit f4b251aeb3
6 changed files with 86 additions and 61 deletions

View File

@@ -8,8 +8,12 @@ const chatController = {
if (!pubkey) {
return res.status(400).json({ error: "Missing publicKey" });
}
await database.createRoom(req.session.publicKey, stringutils.pemToHex(pubkey));
return res.status(201).json({ message: "Room created successfully." });
const hexKey = stringutils.pemToHex(pubkey)
const roomid = await database.createRoom(req.session.publicKey, hexKey);
return res.status(201).json({ message: "Room created successfully.",
roomid: roomid,
peer: hexKey
});
} catch (error) {
console.error("Error creating the room:", error);
return res.status(500).json({ error: "Failed to create the room" });