Fix Lobby tab switching and message submission logic
This commit is contained in:
parent
698737cb5e
commit
c514c5fb73
|
|
@ -104,7 +104,7 @@
|
|||
<div class="chat-main">
|
||||
<!-- Tab bar -->
|
||||
<div id="tab-bar" class="tab-bar">
|
||||
<button class="tab-btn active" data-room="lobby" id="tab-lobby">
|
||||
<button class="tab-btn active" data-room="lobby" id="tab-lobby" onclick="switchTab('lobby')">
|
||||
<span>💋 Lobby</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -349,16 +349,20 @@ messageForm.addEventListener("submit", async (e) => {
|
|||
const isVioletRoom = state.currentRoom.toLowerCase().endsWith(":violet");
|
||||
|
||||
if (isVioletRoom) {
|
||||
// AI Transit Encryption PM Flow
|
||||
const transitKeyB64 = await SexyChato.exportKeyBase64(state.cryptoKey);
|
||||
const encrypted = await SexyChato.encrypt(state.cryptoKey, text);
|
||||
|
||||
socket.emit("pm_message", {
|
||||
room: state.currentRoom,
|
||||
ciphertext: encrypted.ciphertext,
|
||||
nonce: encrypted.nonce,
|
||||
transit_key: transitKeyB64
|
||||
});
|
||||
if (!state.isRegistered || !state.cryptoKey) {
|
||||
addMessage(state.currentRoom, { system: true, text: "You must be logged in to chat with Violet." });
|
||||
} else {
|
||||
// AI Transit Encryption PM Flow
|
||||
const transitKeyB64 = await SexyChato.exportKeyBase64(state.cryptoKey);
|
||||
const encrypted = await SexyChato.encrypt(state.cryptoKey, text);
|
||||
|
||||
socket.emit("pm_message", {
|
||||
room: state.currentRoom,
|
||||
ciphertext: encrypted.ciphertext,
|
||||
nonce: encrypted.nonce,
|
||||
transit_key: transitKeyB64
|
||||
});
|
||||
}
|
||||
} else if (state.isRegistered && state.cryptoKey) {
|
||||
// E2E PM Flow
|
||||
const encrypted = await SexyChato.encrypt(state.cryptoKey, text);
|
||||
|
|
|
|||
Loading…
Reference in New Issue