docs: 添加多账号 OAuth 支持文档
- 添加 add-account.js 和 sync-accounts.sh 使用说明 - 说明配置优先级和账号管理特性 - accounts.json 添加到 .gitignore
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ node_modules/
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
*.txt
|
*.txt
|
||||||
AGENTS.md
|
AGENTS.md
|
||||||
|
accounts.json
|
||||||
41
README.md
41
README.md
@@ -78,8 +78,49 @@ export DROID_REFRESH_KEY="your_refresh_token_here"
|
|||||||
|
|
||||||
# 方式4:无配置(客户端授权)
|
# 方式4:无配置(客户端授权)
|
||||||
# 服务器将使用客户端请求头中的authorization字段
|
# 服务器将使用客户端请求头中的authorization字段
|
||||||
|
|
||||||
|
# 方式5:多账号OAuth(推荐免费用户)
|
||||||
|
# 使用 accounts.json 配置多个账号自动轮询
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 多账号 OAuth 支持(推荐)
|
||||||
|
|
||||||
|
适用于免费账号用户,支持多个账号自动轮询:
|
||||||
|
|
||||||
|
**1. 添加账号**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 交互式添加账号(自动打开浏览器完成授权)
|
||||||
|
node add-account.js
|
||||||
|
|
||||||
|
# 连续添加多个账号
|
||||||
|
node add-account.js --loop
|
||||||
|
```
|
||||||
|
|
||||||
|
**2. 同步到远程服务器**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 配置 .env 中的同步参数
|
||||||
|
SYNC_SERVER=user@your-server.com
|
||||||
|
SYNC_REMOTE_PATH=/opt/droid2api
|
||||||
|
DEPLOY_TYPE=docker-compose
|
||||||
|
|
||||||
|
# 运行同步脚本
|
||||||
|
./sync-accounts.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**3. 配置优先级**
|
||||||
|
|
||||||
|
```
|
||||||
|
accounts.json (多账号OAuth) > FACTORY_API_KEY > DROID_REFRESH_KEY > ~/.factory/auth.json
|
||||||
|
```
|
||||||
|
|
||||||
|
**4. 账号管理特性**
|
||||||
|
- ✅ 基于健康度加权轮询选择账号
|
||||||
|
- ✅ 自动刷新 access_token(每6小时)
|
||||||
|
- ✅ 401/402 错误时自动禁用异常账号
|
||||||
|
- ✅ 请求统计和健康度监控
|
||||||
|
|
||||||
### 2. 配置模型(可选)
|
### 2. 配置模型(可选)
|
||||||
|
|
||||||
编辑 `config.json` 添加或修改模型:
|
编辑 `config.json` 添加或修改模型:
|
||||||
|
|||||||
Reference in New Issue
Block a user