Attempted fix for the selfhosted webclient.
This commit is contained in:
parent
44cdbde003
commit
0fd8ce7788
1 changed files with 6 additions and 35 deletions
|
|
@ -6,33 +6,11 @@
|
||||||
<title>Web Chat Client</title>
|
<title>Web Chat Client</title>
|
||||||
<script src="https://cdn.socket.io/4.5.0/socket.io.min.js"></script>
|
<script src="https://cdn.socket.io/4.5.0/socket.io.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body { font-family: Arial, sans-serif; margin: 0; padding: 0; display: flex; flex-direction: column; height: 100vh; }
|
||||||
font-family: Arial, sans-serif;
|
#chat { flex: 1; overflow-y: auto; padding: 10px; border-bottom: 1px solid #ccc; }
|
||||||
margin: 0;
|
#messageInput { display: flex; padding: 10px; }
|
||||||
padding: 0;
|
#messageInput input { flex: 1; padding: 10px; font-size: 16px; }
|
||||||
display: flex;
|
#messageInput button { padding: 10px; font-size: 16px; }
|
||||||
flex-direction: column;
|
|
||||||
height: 100vh;
|
|
||||||
}
|
|
||||||
#chat {
|
|
||||||
flex: 1;
|
|
||||||
overflow-y: auto;
|
|
||||||
padding: 10px;
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
#messageInput {
|
|
||||||
display: flex;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
#messageInput input {
|
|
||||||
flex: 1;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
#messageInput button {
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -50,9 +28,8 @@
|
||||||
let username = prompt("Enter your username:");
|
let username = prompt("Enter your username:");
|
||||||
let chatRoom = prompt("Enter chat room (default: 'default')") || 'default';
|
let chatRoom = prompt("Enter chat room (default: 'default')") || 'default';
|
||||||
|
|
||||||
// Log the join event data
|
|
||||||
console.log('Joining chat room:', { username: username, chat_room: chatRoom });
|
|
||||||
// Join the chat room
|
// Join the chat room
|
||||||
|
console.log('Joining chat room:', { username: username, chat_room: chatRoom });
|
||||||
socket.emit('join', { username: username, chat_room: chatRoom });
|
socket.emit('join', { username: username, chat_room: chatRoom });
|
||||||
|
|
||||||
// Listen for messages from the server
|
// Listen for messages from the server
|
||||||
|
|
@ -67,17 +44,11 @@
|
||||||
function sendMessage() {
|
function sendMessage() {
|
||||||
const message = messageInput.value;
|
const message = messageInput.value;
|
||||||
if (message.trim() !== '') {
|
if (message.trim() !== '') {
|
||||||
// Log the send_message event data
|
|
||||||
console.log('Sending message:', { username: username, chat_room: chatRoom, message: message });
|
console.log('Sending message:', { username: username, chat_room: chatRoom, message: message });
|
||||||
socket.emit('send_message', { username: username, chat_room: chatRoom, message: message });
|
socket.emit('send_message', { username: username, chat_room: chatRoom, message: message });
|
||||||
messageInput.value = ''; // Clear the input field
|
messageInput.value = ''; // Clear the input field
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log the send_message event data
|
|
||||||
console.log('Sending message:', { username: username, chat_room: chatRoom, message: message });
|
|
||||||
// Send a message to the server
|
|
||||||
socket.emit('send_message', { username: username, chat_room: chatRoom, message: message });
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue