From dfa5aa22ba6fa82dfca25b4acf46eaf5449fc9e0 Mon Sep 17 00:00:00 2001
From: shuaiplus <2327005759@qq.com>
Date: Mon, 5 May 2025 01:28:55 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/index.html | 17 ++++++++---------
web/main.js | 23 +++++++----------------
web/style.css | 2 +-
3 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/web/index.html b/web/index.html
index f785835..90ce755 100644
--- a/web/index.html
+++ b/web/index.html
@@ -8,22 +8,21 @@
-
Sign in to Chatroom
-
请输入用户名、房间名,房间密码
+
Enter a Node
@@ -32,11 +31,11 @@
diff --git a/web/main.js b/web/main.js
index 573bc77..3032b7a 100644
--- a/web/main.js
+++ b/web/main.js
@@ -159,7 +159,7 @@ function addMsg(text, isHistory = false) {
chatArea.scrollTop = chatArea.scrollHeight;
}
-function addOtherMsg(msg, name = '匿名', avatar = '', isHistory = false) {
+function addOtherMsg(msg, name = 'Anonymous', avatar = '', isHistory = false) {
// 只有新消息才记录
if (!isHistory && activeRoomIndex >= 0) roomsData[activeRoomIndex].messages.push({ type: 'other', text: msg, name, avatar });
const chatArea = document.getElementById('chat-area');
@@ -204,10 +204,6 @@ function loginFormHandler(modal) {
const username = document.getElementById('username').value.trim();
const room = document.getElementById('room').value.trim();
const password = document.getElementById('password').value.trim();
- if (!username || !room) {
- alert('请输入用户名和房间名');
- return;
- }
// 生成房间数据并切换
const newRd = getNewRoomData();
newRd.room = room;
@@ -224,11 +220,11 @@ function loginFormHandler(modal) {
if (modal) modal.remove();
else document.getElementById('login-container').style.display = 'none';
document.getElementById('chat-container').style.display = '';
- setStatus('正在连接...');
+ setStatus('Connecting...');
// 初始化 ChatCrypt
const callbacks = {
- onServerClosed: () => setStatus('服务器连接关闭'),
- onServerSecured: () => setStatus('与服务器安全连接已建立'),
+ onServerClosed: () => setStatus('Server connection closed'),
+ onServerSecured: () => setStatus('Secure connection to server'),
onClientSecured: (user) => handleClientSecured(idx, user),
onClientList: (list, selfId) => handleClientList(idx, list, selfId),
onClientLeft: (clientId) => handleClientLeft(idx, clientId),
@@ -257,7 +253,6 @@ function openLoginModal() {
Sign in to Chatroom
-
请输入用户名、房间名,房间密码可选