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"> <div class="chat-main">
<!-- Tab bar --> <!-- Tab bar -->
<div id="tab-bar" class="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> <span>💋 Lobby</span>
</button> </button>
</div> </div>

View File

@ -349,16 +349,20 @@ messageForm.addEventListener("submit", async (e) => {
const isVioletRoom = state.currentRoom.toLowerCase().endsWith(":violet"); const isVioletRoom = state.currentRoom.toLowerCase().endsWith(":violet");
if (isVioletRoom) { if (isVioletRoom) {
// AI Transit Encryption PM Flow if (!state.isRegistered || !state.cryptoKey) {
const transitKeyB64 = await SexyChato.exportKeyBase64(state.cryptoKey); addMessage(state.currentRoom, { system: true, text: "You must be logged in to chat with Violet." });
const encrypted = await SexyChato.encrypt(state.cryptoKey, text); } else {
// AI Transit Encryption PM Flow
socket.emit("pm_message", { const transitKeyB64 = await SexyChato.exportKeyBase64(state.cryptoKey);
room: state.currentRoom, const encrypted = await SexyChato.encrypt(state.cryptoKey, text);
ciphertext: encrypted.ciphertext,
nonce: encrypted.nonce, socket.emit("pm_message", {
transit_key: transitKeyB64 room: state.currentRoom,
}); ciphertext: encrypted.ciphertext,
nonce: encrypted.nonce,
transit_key: transitKeyB64
});
}
} else if (state.isRegistered && state.cryptoKey) { } else if (state.isRegistered && state.cryptoKey) {
// E2E PM Flow // E2E PM Flow
const encrypted = await SexyChato.encrypt(state.cryptoKey, text); const encrypted = await SexyChato.encrypt(state.cryptoKey, text);