112 lines
2.5 KiB
Markdown
112 lines
2.5 KiB
Markdown
# 蜂鸟CursorPro 后端
|
|
|
|
## 域名配置
|
|
|
|
| 类型 | 域名 | 说明 |
|
|
|------|------|------|
|
|
| 主域名 | `api.aicode.edu.pl` | 主后台服务器 |
|
|
| 备用域名1 | `hb.aicode.edu.pl` | 反代到主域名 |
|
|
| 备用域名2 | `cursor.aicode.edu.pl` | 反代到主域名 |
|
|
| 备用域名3 | `pro.aicode.edu.pl` | 反代到主域名 |
|
|
|
|
## 登录信息
|
|
|
|
```
|
|
管理后台: https://api.aicode.edu.pl/
|
|
用户名: admin
|
|
密码: Hb@2024Pro!
|
|
```
|
|
|
|
## 外部API
|
|
|
|
```
|
|
Token: hb-ext-9kX2mP5nQ8rT1vY4zA7c
|
|
Header: X-API-Token
|
|
|
|
批量上传: POST /admin/external/accounts/batch
|
|
账号统计: GET /admin/external/accounts/stats
|
|
```
|
|
|
|
## 部署
|
|
|
|
```bash
|
|
# 上传到服务器
|
|
cd /opt/cursorpro
|
|
|
|
# 启动 (首次自动创建venv并安装依赖)
|
|
./start.sh
|
|
|
|
# 停止
|
|
./stop.sh
|
|
|
|
# 查看日志
|
|
tail -f cursorpro.log
|
|
```
|
|
|
|
部署信息:
|
|
- 管理后台: https://api.aicode.edu.pl/
|
|
- API文档: https://api.aicode.edu.pl/docs
|
|
- 健康检查: ✅ {"status":"ok"}
|
|
|
|
登录信息:
|
|
用户名: admin
|
|
密码: Hb@2024Pro!
|
|
|
|
外部API Token: hb-ext-9kX2mP5nQ8rT1vY4zA7c
|
|
|
|
现在需要配置备用域名反代吗?还是先测试插件对接?
|
|
|
|
|
|
## Nginx 配置
|
|
|
|
### 主域名 (api.aicode.edu.pl)
|
|
```nginx
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name api.aicode.edu.pl;
|
|
|
|
ssl_certificate /etc/ssl/api.aicode.edu.pl.pem;
|
|
ssl_certificate_key /etc/ssl/api.aicode.edu.pl.key;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
}
|
|
```
|
|
|
|
### 备用域名 (反代到主域名)
|
|
```nginx
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name hb.aicode.edu.pl; # 或 cursor.aicode.edu.pl / pro.aicode.edu.pl
|
|
|
|
ssl_certificate /etc/ssl/hb.aicode.edu.pl.pem;
|
|
ssl_certificate_key /etc/ssl/hb.aicode.edu.pl.key;
|
|
|
|
location / {
|
|
proxy_pass https://api.aicode.edu.pl;
|
|
proxy_set_header Host api.aicode.edu.pl;
|
|
proxy_ssl_server_name on;
|
|
}
|
|
}
|
|
```
|
|
|
|
## 客户端插件域名配置
|
|
|
|
插件 `extension/out/api/client.js` 中已配置:
|
|
```javascript
|
|
const API_DOMAINS = [
|
|
'https://api.aicode.edu.pl', // 主域名
|
|
'https://hb.aicode.edu.pl', // 备用域名1
|
|
'https://cursor.aicode.edu.pl', // 备用域名2
|
|
'https://pro.aicode.edu.pl', // 备用域名3
|
|
'http://127.0.0.1:8000' // 本地开发
|
|
];
|
|
```
|
|
|
|
自动故障转移:主域名失败会自动切换到备用域名。
|