更新i18n,帮助页面正式完工

This commit is contained in:
shuaiplus committed 2025-06-06 04:49:17 +08:00
1 parent a6d5ab9166
commit 2816cee274
5 files changed
+101 -39

No files matched your search

+4 -4
View File
@@ -150,10 +150,10 @@ body {
background: #fff;
border-radius: 14px;
box-shadow: 0 2px 16px rgba(60, 80, 100, 0.09); */
display: flex;
flex-direction: row;
justify-content: space-around;
text-align: center;
display: flex;
text-align: center;
align-items: center;
flex-direction: column;
}
.login-container h1 {
+23 -26
View File
@@ -37,9 +37,8 @@
<div class="flip-card" id="flip-card">
<div class="flip-card-inner">
<!-- 卡片正面 - 登录表单 -->
<div class="flip-card-front">
<!-- 帮助按钮 -->
<button class="help-btn" id="help-btn" type="button" title="使用说明">
<div class="flip-card-front"> <!-- 帮助按钮 -->
<button class="help-btn" id="help-btn" type="button" data-i18n-title="help.usage_guide">
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
<path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
@@ -51,41 +50,43 @@
<!-- 登录表单内容将由JavaScript动态生成 -->
<!-- Login form content will be dynamically generated by JavaScript -->
</form>
</div>
<!-- 卡片背面 - 使用说明 --> <div class="flip-card-back">
<button class="help-btn back-btn" id="back-btn" type="button" title="返回登录">
</div> <!-- 卡片背面 - 使用说明 --> <div class="flip-card-back">
<button class="help-btn back-btn" id="back-btn" type="button" data-i18n-title="help.back_to_login">
<svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15 18L9 12L15 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button> <h2>使用说明</h2>
</button> <h2 data-i18n="help.usage_guide">使用说明</h2>
<div class="help-content">
<div class="help-section">
<h3>🔐 什么是 NodeCrypt?</h3>
<p>NodeCrypt 是一个开源的端到端加密聊天系统,采用无数据库架构设计。所有消息在您的设备上本地加密,服务器和中间人无法解密您的任何聊天内容。</p>
<h3 data-i18n="help.what_is_nodecrypt">🔐 什么是 NodeCrypt?</h3>
<p data-i18n="help.what_is_nodecrypt_desc">NodeCrypt 是一个开源的端到端加密聊天系统,采用无数据库架构设计。所有消息在您的设备上本地加密,服务器和中间人无法解密您的任何聊天内容。</p>
</div>
<div class="help-section">
<h3>🚀 如何开始?</h3>
<h3 data-i18n="help.how_to_start">🚀 如何开始?</h3>
<ol>
<li><strong>输入用户名</strong>:选择一个昵称</li>
<li><strong>输入节点名</strong>:创建或加入现有房间</li>
<li><strong>设置节点密码</strong>:用于排除巧合性</li>
<li><strong>点击"加入房间"</strong>:开始安全聊天</li>
<li><strong data-i18n="help.step_username">输入用户名</strong>:<span data-i18n="help.step_username_desc">选择一个昵称</span></li>
<li><strong data-i18n="help.step_node_name">输入节点名</strong>:<span data-i18n="help.step_node_name_desc">创建或加入现有房间</span></li>
<li><strong data-i18n="help.step_password">设置节点密码</strong>:<span data-i18n="help.step_password_desc">用于排除巧合性</span></li>
<li><strong data-i18n="help.step_join">点击"加入房间"</strong>:<span data-i18n="help.step_join_desc">开始安全聊天</span></li>
</ol>
</div>
<div class="help-section">
<h3>🔑 安全特性</h3>
<h3 data-i18n="help.security_features">🔑 安全特性</h3>
<ul>
<li><strong>端到端加密</strong>:消息仅您和接收者可解密</li>
<li><strong>无历史记录</strong>:新用户无法看到历史消息</li>
<li><strong>密码保护</strong>:房间密码参与加密过程</li>
<li><strong>匿名通信</strong>:无需注册真实身份</li>
<li><strong data-i18n="help.e2e_encryption">端到端加密</strong>:<span data-i18n="help.e2e_encryption_desc">消息仅您和接收者可解密</span></li>
<li><strong data-i18n="help.no_history">无历史记录</strong>:<span data-i18n="help.no_history_desc">新用户无法看到历史消息</span></li>
<li><strong data-i18n="help.password_protection">密码保护</strong>:<span data-i18n="help.password_protection_desc">房间密码参与加密过程</span></li>
<li><strong data-i18n="help.anonymous_communication">匿名通信</strong>:<span data-i18n="help.anonymous_communication_desc">无需注册真实身份</span></li>
</ul>
</div>
</div>
</div>
</div>
</div> </div>
</div>
<div class="powered-by">
Powered by <a href="https://github.com/shuaiplus/NodeCrypt" target="_blank" rel="noopener">NodeCrypt</a>
&copy; 2025 by <a href="https://github.com/shuaiplus" target="_blank" rel="noopener">@shuaiplus</a>
</div>
</div><div class="container" id="chat-container" style="display:none;">
<div class="mobile-sidebar-mask" id="mobile-sidebar-mask"></div>
@@ -168,11 +169,7 @@
</div>
</div>
</div>
<div class="rightbar-tabs tabs" id="member-tabs"> </div> <div class="members" id="member-list"> </div>
</div> </div> <div class="powered-by">
Powered by <a href="https://github.com/shuaiplus/NodeCrypt" target="_blank" rel="noopener">NodeCrypt</a>
&copy; 2025 by <a href="https://github.com/shuaiplus" target="_blank" rel="noopener">@shuaiplus</a>
</div>
<div class="rightbar-tabs tabs" id="member-tabs"> </div> <div class="members" id="member-list"> </div> </div> </div>
<script type="module" src="./js/main.js"></script>
</body>
</html>
+2 -2
View File
@@ -83,8 +83,8 @@ import { renderUserList, // 渲染用户列表 / Render user list
// 设置全局配置参数
// Set global configuration parameters
window.config = {
wsAddress: `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}`, // WebSocket 服务器地址 / WebSocket server address
//wsAddress: `wss://crypt.works`,
//wsAddress: `${window.location.protocol === 'https:' ? 'wss:' : 'ws:'}//${window.location.host}`, // WebSocket 服务器地址 / WebSocket server address
wsAddress: `wss://crypt.works`,
debug: true // 是否开启调试模式 / Enable debug mode
};
-1
View File
@@ -114,7 +114,6 @@ export function joinRoom(userName, roomName, password, modal = null, onResult) {
onResult(false)
}
}, onServerSecured: () => {
setStatus('Secure connection to node');
if (modal) modal.remove();
else {
const loginContainer = $id('login-container');
+72 -6
View File
@@ -75,8 +75,7 @@ const LANGUAGES = {
'action.copy_not_supported': 'Copy not supported in this environment',
'action.action_failed': 'Action failed. Please try again.',
'action.cannot_share': 'Cannot share:',
// System messages
// System messages
'system.security_warning': '⚠️ This link uses an old format. Room data is not encrypted.',
'system.file_send_failed': 'Failed to send files:',
'system.joined': 'joined the conversation',
@@ -85,6 +84,30 @@ const LANGUAGES = {
'system.private_message_failed': 'Cannot send private message to',
'system.private_file_failed': 'Cannot send private file to',
'system.user_not_connected': 'User might not be fully connected.',
// Help page
'help.title': 'User Guide',
'help.back_to_login': 'Back to Login',
'help.usage_guide': 'User Guide',
'help.what_is_nodecrypt': '🔐 What is NodeCrypt?',
'help.what_is_nodecrypt_desc': 'NodeCrypt is an open-source end-to-end encrypted chat system with a database-free architecture. All messages are encrypted locally on your device, and servers and intermediaries cannot decrypt any of your chat content.',
'help.how_to_start': '🚀 How to Start?',
'help.step_username': 'Username',
'help.step_username_desc': 'Choose a nickname',
'help.step_node_name': 'Node Name',
'help.step_node_name_desc': 'Create or join an existing node',
'help.step_password': 'Node Password',
'help.step_password_desc': 'Ensure node independence when room names are the same',
'help.step_join': 'Click "Join Room"',
'help.step_join_desc': 'Start end-to-end encrypted chatting',
'help.security_features': '🔑 Security Features',
'help.e2e_encryption': 'End-to-End Encryption',
'help.e2e_encryption_desc': 'Messages can only be decrypted by you and the recipient',
'help.no_history': 'No History Records',
'help.no_history_desc': 'New users cannot see historical messages',
'help.password_protection': 'Password Protection',
'help.password_protection_desc': 'Room password participates in the encryption process',
'help.anonymous_communication': 'Anonymous Communication',
'help.anonymous_communication_desc': 'No need to register real identity',
}
},
zh: {
@@ -158,8 +181,7 @@ const LANGUAGES = {
'action.copy_not_supported': '此环境不支持复制功能',
'action.action_failed': '操作失败,请重试。',
'action.cannot_share': '无法分享:',
// System messages
// System messages
'system.security_warning': '⚠️ 此链接使用旧格式,房间数据未加密。',
'system.file_send_failed': '文件发送失败:',
'system.joined': '加入了对话',
@@ -168,6 +190,31 @@ const LANGUAGES = {
'system.private_message_failed': '无法发送私信给',
'system.private_file_failed': '无法发送私密文件给',
'system.user_not_connected': '用户可能未完全连接。',
// Help page
'help.title': '使用说明',
'help.back_to_login': '返回登录',
'help.usage_guide': '使用说明',
'help.what_is_nodecrypt': '🔐 什么是 NodeCrypt?',
'help.what_is_nodecrypt_desc': 'NodeCrypt 是一个开源的端到端加密聊天系统,采用无数据库架构设计。所有消息在您的设备上本地加密,服务器和中间人无法解密您的任何聊天内容。',
'help.how_to_start': '🚀 如何开始?',
'help.step_username': '用户名',
'help.step_username_desc': '选择一个昵称',
'help.step_node_name': '节点名称',
'help.step_node_name_desc': '创建或加入现有节点',
'help.step_password': '节点密码',
'help.step_password_desc': '确保房间号相同时节点的独立性',
'help.step_join': '点击"加入房间"',
'help.step_join_desc': '开始端到端加密聊天',
'help.security_features': '🔑 安全特性',
'help.e2e_encryption': '端到端加密',
'help.e2e_encryption_desc': '消息仅您和接收者可解密',
'help.no_history': '无历史记录',
'help.no_history_desc': '新用户无法看到历史消息',
'help.password_protection': '密码保护',
'help.password_protection_desc': '房间密码参与加密过程',
'help.anonymous_communication': '匿名通信',
'help.anonymous_communication_desc': '无需注册真实身份',
}
}
};
@@ -323,11 +370,30 @@ export function updateStaticTexts() {
settingsBtn.title = t('action.settings', 'Settings');
settingsBtn.setAttribute('aria-label', t('action.settings', 'Settings'));
}
// Update back button title
// Update back button title
const backBtn = document.getElementById('settings-back-btn');
if (backBtn) {
backBtn.title = t('action.back', 'Back');
backBtn.setAttribute('aria-label', t('action.back', 'Back'));
}
// Update all elements with data-i18n attribute
// 更新所有具有data-i18n属性的元素
const i18nElements = document.querySelectorAll('[data-i18n]');
i18nElements.forEach(element => {
const key = element.getAttribute('data-i18n');
if (key) {
element.textContent = t(key, element.textContent || key);
}
});
// Update all elements with data-i18n-title attribute
// 更新所有具有data-i18n-title属性的元素
const i18nTitleElements = document.querySelectorAll('[data-i18n-title]');
i18nTitleElements.forEach(element => {
const key = element.getAttribute('data-i18n-title');
if (key) {
element.title = t(key, element.title || key);
}
});
}