Add HTTPS demo entry for microphone access

- Add a self-signed HTTPS Nginx entrypoint on Docker port 4443 so browser microphone APIs can run in demo mode.

- Keep the existing HTTP port 4002 unchanged while exposing container port 443 and generating the demo certificate during image build.

- Update CORS defaults and Compose environment for the HTTPS frontend origin.

- Clarify the report editor microphone message with localhost, HTTPS, and browser trusted-origin demo options.

- Document the browser HTTP microphone limitation, HTTPS demo URL, and Chrome/Edge insecure-origin workaround in README and docs.
This commit is contained in:
2026-05-02 03:34:31 +08:00
parent 2a86d9f5e4
commit b346b7e194
12 changed files with 81 additions and 11 deletions

View File

@@ -28,6 +28,7 @@ docker compose version
| NestJS API 本地服务 | `3100` | `npm run server:dev` 默认监听 |
| Docker API 暴露端口 | `3002` | 宿主机访问 Compose API |
| Docker 前端入口 | `4002` | 推荐的整套系统访问入口 |
| Docker 前端 HTTPS 演示入口 | `4443` | 自签名证书入口,推荐用于麦克风听写 |
| Docker PostgreSQL | `5433` | 宿主机访问 Compose 数据库 |
如果这些端口被占用,优先修改 `.env``docker-compose.yaml` 和对应文档,避免回退到 `3000` 等默认端口。
@@ -45,6 +46,7 @@ docker compose up -d --build
```text
http://localhost:4002
https://localhost:4443
```
健康检查:
@@ -56,7 +58,7 @@ curl http://localhost:3002/api/health
当前 Compose 会启动:
- `tuwen_web`Nginx 托管前端,宿主机端口 `4002`
- `tuwen_web`Nginx 托管前端,宿主机端口 `4002`;同时提供自签名 HTTPS 演示入口 `4443`
- `tuwen_api`NestJS API容器内监听 `3100`,宿主机端口 `3002`
- `tuwen_db`PostgreSQL 16宿主机端口 `5433`
@@ -149,7 +151,7 @@ VITE_API_PROXY_TARGET="http://localhost:3002"
完成启动后建议按顺序验证:
1. 打开 `http://localhost:4002` 或本地开发地址 `http://localhost:3001`
1. 打开 `http://localhost:4002`、语音演示地址 `https://localhost:4443` 或本地开发地址 `http://localhost:3001`
2. 使用 `admin / 123456` 登录。
3. 进入工作台,确认统计卡片能正常加载。
4. 进入“系统设置”,确认全局配置可保存。
@@ -190,7 +192,7 @@ Docker 方式应访问 `http://localhost:4002`。本地开发方式应确保 `np
检查占用:
```bash
ss -ltnp | grep -E ':3001|:3002|:3100|:4002|:5433'
ss -ltnp | grep -E ':3001|:3002|:3100|:4002|:4443|:5433'
```
本项目不应使用 `3000` 作为默认 API 端口。如果必须改端口,同步修改 `.env``docker-compose.yaml``vite.config.ts` 或 Nginx upstream并更新文档。