You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
Markdown
48 lines
1.5 KiB
Markdown
# OnlineMsg Web Client
|
|
|
|
React 前端客户端,适配当前仓库的加密消息协议,默认隐藏连接细节,仅保留聊天交互。
|
|
|
|
## 开发运行
|
|
|
|
```bash
|
|
cd web-client
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
默认地址:`http://localhost:5173`
|
|
|
|
## 生产构建
|
|
|
|
```bash
|
|
cd web-client
|
|
npm install
|
|
npm run build
|
|
npm run preview
|
|
```
|
|
|
|
构建产物输出目录:`web-client/dist`
|
|
|
|
## 使用说明
|
|
|
|
- 打开页面后点击“连接”
|
|
- 默认会自动使用当前主机名拼接:
|
|
- `http` 页面下:`ws://<host>:13173/`
|
|
- `https` 页面下:`wss://<host>:13173/`
|
|
- 若你手动输入 `ws://`,前端会自动尝试升级到 `wss://` 一次
|
|
- 如需手动指定服务器地址,在“高级连接设置”中填写,例如:
|
|
- `wss://example.com:13173/`
|
|
- `ws://127.0.0.1:13173/`(仅本地调试)
|
|
- “目标公钥”留空为广播,填写后为私聊转发
|
|
- 用户名会自动保存在本地,刷新后继续使用
|
|
- 客户端私钥会保存在本地浏览器(用于持续身份),刷新后不会重复生成
|
|
|
|
## 移动端注意事项
|
|
|
|
- 客户端已支持两套加密实现:
|
|
- 优先 `WebCrypto`(性能更好)
|
|
- 退化到纯 JS `node-forge`(适配部分 `http` 局域网场景)
|
|
- 在纯 JS 加密模式下,首次连接可能需要几秒生成密钥;客户端会复用本地缓存密钥以减少后续等待。
|
|
- 若设备浏览器过旧,仍可能无法完成加密初始化,此时会在页面提示具体原因。
|
|
- 生产环境仍建议使用 `https/wss`。
|