32 lines
1.9 KiB
Markdown
32 lines
1.9 KiB
Markdown
# XHChat
|
||
|
||
本仓库公开源码供查阅,修改、分发与部署需经权利人书面授权。禁止将查阅权限用于违法活动。详见 [XHChat 源码查阅许可协议](LICENSE)。
|
||
|
||
Windows 桌面端位于 `Desktop`,Web 客户端位于 `web`。当前版本实现用户名注册和登录、独立设备身份、设备查看与撤销、退出登录及经认证的实时连接。完整产品按 [阶段进度](docs/progress.md) 交付。
|
||
|
||
## 本地运行
|
||
|
||
环境需要 Docker Compose、Node.js 24 和 npm。首次启动时在仓库根目录执行以下 PowerShell 命令。已有 `.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
|
||
npm.cmd ci
|
||
npm.cmd run build
|
||
npm.cmd run desktop
|
||
```
|
||
|
||
Web 客户端独立访问 [本机 Web](http://127.0.0.1:8080)。桌面端默认连接同一服务。两端以相同用户名和密码登录,各自生成设备身份。桌面端可通过 `XHCHAT_SERVER_URL` 指定 HTTPS 部署地址。
|
||
|
||
## 开发与部署
|
||
|
||
- [总体架构与目录](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)
|
||
|
||
`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 交叉测试。
|