优化 Gitea 项目首页与预览说明 #4

Merged
xhgit merged 1 commits from xhgit/readme-project-home into main 2026-11-13 18:24:10 +08:00
+39 -11
View File
@@ -1,12 +1,30 @@
# XHChat
本仓库公开源码供查阅,修改、分发与部署需经权利人书面授权。禁止将查阅权限用于违法活动。详见 [XHChat 源码查阅许可协议](LICENSE)。
面向 Windows 与 Web 的即时通讯项目,目标是提供端到端加密通信、群组和实时音视频。Windows 客户端内置独立的 Chromium 浏览器。
Windows 桌面端位于 `Desktop`,Web 客户端位于 `web`。当前版本实现用户名注册与登录、设备管理、实时联系人管理和隔离的 Chromium 浏览器窗口。完整产品按 [阶段进度](docs/progress.md) 交付。
[![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)
环境需要 Docker Compose、Node.js 24 和 npm。首次启动时在仓库根目录执行以下 PowerShell 命令。已有 `.env` 时保留原配置。
## 当前功能
| 功能 | 可体验内容 |
| --- | --- |
| 账号与设备 | Windows 和 Web 共用账号,支持用户名注册、登录、查看设备和远程撤销。 |
| 联系人 | 按用户名查找、处理好友申请、管理备注与分组,以及拉黑。变更可在双端实时同步。 |
| Chromium 浏览器 | Windows 端支持独立窗口、多标签、导航、搜索和隐私窗口,网页运行在独立会话中。 |
当前为开发预览。OpenMLS 已完成原生与浏览器的协议验证。应用内加密聊天、群聊和音视频仍在开发,Windows 安装包尚未发布。 [开发进度与验收记录](docs/progress.md)
## 本地预览
以下步骤适用于获授权的维护者和测试者。需要 **PowerShell 7**、**Docker Compose v2**。启动 Windows 客户端还需要 **Node.js 24** 和 **npm**。
在项目根目录启动 Web 和服务端。首次启动时会生成本地数据库密码,已有 `.env` 将继续使用。
```powershell
if (-not (Test-Path .env)) {
@@ -14,18 +32,28 @@ if (-not (Test-Path .env)) {
(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
npm.cmd run build
npm.cmd run desktop
```
Web 客户端独立访问 [本机 Web](http://127.0.0.1:8080)。桌面端默认连接同一服务。两端以相同用户名和密码登录,各自生成设备身份。桌面端可通过 `XHCHAT_SERVER_URL` 指定 HTTPS 部署地址。
在 Windows 端使用同一账号登录。在「设备管理」中可以看到 Web 和 Windows 的独立设备记录。部署到自定义域名和配置 HTTPS 的步骤见 [部署文档](docs/deployment.md)。
## 开发与部署
## 开发文档
- [总体架构与目录](docs/architecture.md)
- [数据库](docs/database.md) · [API](docs/api.md) · [部署](docs/deployment.md)
- [加密协议](docs/encryption.md) · [音视频](docs/realtime-media.md) · [浏览器安全与威胁模型](docs/browser-security.md)
- [进度与验收记录](docs/progress.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 run check` 执行双端类型检查。服务端需要 Go 1.27.4 或兼容的更新版本,在 `server` 内使用 `go test ./...`。本机 Compose 启动后,使用 `node --test tests/api.test.mjs` 运行 API 集成测试。Windows 上使用 `npm.cmd run build`、`npm.cmd run build -w Desktop` 和 `node --test tests/clients.test.mjs` 构建并运行 Edge 与 Electron 交叉测试。
`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)