Fix Lobby tab switching and message submission logic

This commit is contained in:
Antigravity 2026-04-12 18:15:04 +01:00
parent 698737cb5e
commit c514c5fb73
2 changed files with 15 additions and 11 deletions

View File

@ -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>

View File

@ -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);
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
});
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);