fixes lol
All checks were successful
Build and Push / build-all (push) Successful in 9m28s

This commit is contained in:
doomtube 2026-01-10 01:50:20 -05:00
parent 48f62c8c02
commit 33624d3b02
9 changed files with 114 additions and 3 deletions

View file

@ -239,6 +239,12 @@ class ChatWebSocket {
console.log(`Participant left: ${data.username} (${data.participantCount} total)`);
break;
case 'global_history':
// Global chat: merge messages from ALL realms into existing messages
console.log(`Received global history with ${(data.messages || []).length} messages`);
setMessageHistory(data.messages || [], true); // Always merge global history
break;
default:
console.log('Unknown message type:', data.type);
}
@ -368,6 +374,21 @@ class ChatWebSocket {
return true;
}
/**
* Request global chat history (messages from ALL active realms)
* Used for the global chat feature where users can see messages across realms
*/
requestGlobalHistory() {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
console.error('WebSocket not connected');
return false;
}
console.log('[ChatWebSocket] Requesting global history');
this.ws.send(JSON.stringify({ type: 'get_global_history' }));
return true;
}
sendRename(newName) {
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
console.error('WebSocket not connected');

View file

@ -61,9 +61,12 @@
$: isConnected = $connectionStatus === 'connected';
// Auto-load participants when connected
// Auto-load participants and global history when connected
$: if (isConnected) {
chatWebSocket.getParticipants();
// Request global history for global chat feature (messages from ALL realms)
// Small delay to ensure connection is fully established
setTimeout(() => chatWebSocket.requestGlobalHistory(), 500);
}
// Reconnect WebSocket when user logs in or registers while already connected as guest
@ -769,6 +772,7 @@
.chat-panel {
display: flex;
flex-direction: column;
flex: 1 1 0; /* Fill available space in flex parent */
height: 100%;
max-height: 100%;
min-height: 0;
@ -852,7 +856,7 @@
}
.messages-container {
flex: 1 1 0; /* Grow, shrink, base 0 */
flex: 1 1 auto; /* Grow and shrink, but with natural base size */
background: #000;
overflow-y: auto;
overflow-x: hidden;
@ -860,7 +864,7 @@
display: flex;
flex-direction: column;
gap: 0.125rem;
min-height: 0; /* Allow flex shrinking */
min-height: 100px; /* Ensure minimum visibility */
max-height: 100%; /* Don't exceed container */
width: 100%; /* Ensure full width */
}
@ -872,6 +876,7 @@
justify-content: center;
color: #666;
font-style: italic;
min-height: 100px; /* Ensure visibility even if flex calculations fail */
}
.chat-disabled-message {