# Coruna Lab Web 独立的渠道静态资源构建与分发服务,与 [`coruna-lab`](../coruna-lab/)(Laravel C2 / Admin)同级部署。 ```text coruna-lab-web/ ├── frontend/ │ ├── source/ # 只读模板 / 明文输入(勿直接 --apply) │ ├── tools/ # new_project / patch_* │ ├── doc/ # Stage JS / sync / C2 链路文档 │ └── tests/ # native path patch 等工具测试 ├── build_api/ # 同步 Build / Delete HTTP API(FastAPI) ├── docs/BUILD_API.md ├── tests/ # build_api 单元测试 └── artifacts/ # 本地默认产物根(gitignore) └── channel//{web,sync,out,manifest.json} ``` 兄弟项目: ```text ios-fetch/ ├── coruna-lab/ # Laravel:渠道元数据、C2、Admin └── coruna-lab-web/ # 本仓库:构建 + 静态产物站 ``` Laravel 通过 `CORUNA_BUILD_SERVICE_*` 调用本服务的: - `POST /v1/channels/{id}/build` - `DELETE /v1/channels/{id}` 公开静态路径: ```text /channel//web/support.html /channel//sync/daily.html ``` ## Setup ```bash cd coruna-lab-web python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt export BUILD_API_TOKEN="$(python3 -c 'import secrets; print(secrets.token_urlsafe(48))')" export BUILD_API_ARTIFACT_ROOT="$PWD/artifacts" python3 -m build_api ``` 手动构建(不经 API): ```bash python3 frontend/tools/new_project.py \ --channel-id 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' \ --deployment-domains 'www.dep.example' \ --reporting-domains 'www.rep.example' ``` ## Tests ```bash python3 -m unittest discover -s tests -p 'test_*.py' python3 -m unittest discover -s frontend/tests -p 'test_*.py' python3 -m unittest discover -s frontend/tools/tests -p 'test_*.py' ``` ## Deploy 见 [`docs/BUILD_API.md`](docs/BUILD_API.md)。可用宝塔等面板托管进程与反向代理,仓库内不维护 Nginx / systemd 样例。