Files
XHChat/README.md
T

67 lines
4.3 KiB
Markdown

# XHChat
面向 Windows 与 Web 的即时通讯项目,目标是提供端到端加密通信、群组和实时音视频。Windows 客户端内置独立的 Chromium 浏览器。
[![Stars](https://git.xhmcl.com/xhgit/XHChat/badges/stars.svg)](https://git.xhmcl.com/xhgit/XHChat/stars)
[![Watchers](https://git.xhmcl.com/xhgit/XHChat/badges/watchers.svg)](https://git.xhmcl.com/xhgit/XHChat/watchers)
[![Open issues](https://git.xhmcl.com/xhgit/XHChat/badges/issues.svg)](https://git.xhmcl.com/xhgit/XHChat/issues)
[![Open pull requests](https://git.xhmcl.com/xhgit/XHChat/badges/pulls.svg)](https://git.xhmcl.com/xhgit/XHChat/pulls)
[![Contributors](https://git.xhmcl.com/xhgit/XHChat/activity/contributors/badge.svg)](https://git.xhmcl.com/xhgit/XHChat/activity/contributors)
[当前功能](#当前功能) · [本地预览](#本地预览) · [开发文档](#开发文档) · [问题反馈](https://git.xhmcl.com/xhgit/XHChat/issues) · [源码查阅许可](LICENSE)
## 当前功能
| 功能 | 可体验内容 |
| --- | --- |
| 账号与设备 | Windows 和 Web 共用账号,支持用户名注册、登录、查看设备和远程撤销。 |
| 联系人 | 按用户名查找、处理好友申请、管理备注与分组,以及拉黑。变更可在双端实时同步。 |
| 加密文字聊天 | 在两个已核验设备之间发送 MLS 加密消息,支持离线接收。 |
| 加密附件 | 两端可发送和下载最多 8 MiB 的文件,下载时验证完整性。 |
| 消息管理 | 支持引用回复、搜索本机历史、收藏和本机删除。 |
| Chromium 浏览器 | Windows 端支持独立窗口、多标签、导航、搜索、书签、历史、下载和隐私窗口,网页运行在独立会话中。 |
当前为开发预览。大文件分片、群聊、音视频和多设备历史同步仍在开发,Windows 安装包尚未发布。 [开发进度与验收记录](docs/progress.md)
## 本地预览
以下步骤适用于获授权的维护者和测试者。需要 **PowerShell 7**、**Docker Compose v2**。启动 Windows 客户端还需要 **Node.js 24** 和 **npm**。
在项目根目录启动 Web 和服务端。首次启动时会生成本地数据库密码,已有 `.env` 将继续使用。
```powershell
if (-not (Test-Path .env)) {
$xhchatPassword = [Convert]::ToHexString([Security.Cryptography.RandomNumberGenerator]::GetBytes(24)).ToLowerInvariant()
(Get-Content .env.example -Raw).Replace('XHCHAT_DB_PASSWORD=', "XHCHAT_DB_PASSWORD=$xhchatPassword") | Set-Content .env
}
docker compose up -d --build --wait
```
浏览器打开 [http://127.0.0.1:8080](http://127.0.0.1:8080),选择「注册」创建测试账号。要同时体验 Windows 客户端,在项目根目录运行:
```powershell
npm.cmd ci
New-Item -ItemType Directory -Path web/public/mls -Force | Out-Null
docker compose cp web:/usr/share/nginx/html/mls/. web/public/mls
npm.cmd run build
npm.cmd run desktop
```
在 Windows 端使用同一账号登录。在「设备管理」中可以看到 Web 和 Windows 的独立设备记录。部署到自定义域名和配置 HTTPS 的步骤见 [部署文档](docs/deployment.md)。
体验加密文字聊天时,注册两个账号并互加好友。在双方的联系人详情中打开「加密聊天」,启用本机加密,通过另一可信渠道交换安全码,分别核验对方设备后即可互发消息。
## 开发文档
| 主题 | 文档 |
| --- | --- |
| 工程结构 | [总体架构](docs/architecture.md) · [数据库](docs/database.md) · [API](docs/api.md) |
| 通讯与安全 | [加密架构](docs/encryption.md) · [音视频架构](docs/realtime-media.md) · [浏览器隔离](docs/browser-security.md) |
| 部署与验收 | [部署维护](docs/deployment.md) · [开发进度与测试记录](docs/progress.md) · [OpenMLS 兼容性测试](crypto/README.md) |
`npm.cmd run check` 检查双端类型。Go 1.27.4 或兼容的更新版本可在 `server` 目录运行 `go test ./...`。Compose 启动后,可用 `node --test tests/api.test.mjs` 执行 API 集成测试。Windows 构建完成且已安装 Edge 后,可运行 `node --test tests/clients.test.mjs tests/contacts-browser.test.mjs` 验证双端联动与浏览器隔离。
## 许可证
源码公开供查阅。修改、克隆留存、再分发和部署须经权利人书面授权,禁止违法用途。第三方组件遵循各自的许可条款。 [XHChat 源码查阅许可协议](LICENSE)