diff --git a/README.md b/README.md index 773092e9..86c4e68d 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ module.exports = { ```bash # 初始化 -npm run setup # 会随机生成后台账号密码信息,存储在 data/Init.json +npm run setup # 会随机生成后台账号密码信息,存储在 data/init.json # 启动服务 npm run service:start:daemon # 后台运行(推荐) @@ -211,7 +211,7 @@ npm run service:status 浏览器访问:`http://你的服务器IP:3000/web` -默认管理员账号:data/Init.json 中寻找 +默认管理员账号:data/init.json 中寻找 ### 2. 添加Claude账户 @@ -312,10 +312,16 @@ redis-cli ping **1. 安装nginx和获取SSL证书** ```bash # Ubuntu/Debian -sudo apt install nginx certbot python3-certbot-nginx +sudo apt install nginx + +# 安装 acme.sh +curl https://get.acme.sh | sh +source ~/.bashrc # 获取免费SSL证书(以Let's Encrypt为例) -sudo certbot --nginx -d your-domain.com +acme.sh --issue -d your-domain.com --nginx +# 或者使用 standalone 模式 +# acme.sh --issue -d your-domain.com --standalone ``` **2. nginx配置示例** diff --git a/README_EN.md b/README_EN.md index ca507921..43ed47b6 100644 --- a/README_EN.md +++ b/README_EN.md @@ -193,7 +193,7 @@ module.exports = { ```bash # Initialize -npm run setup # Will randomly generate admin account password info, stored in data/Init.json +npm run setup # Will randomly generate admin account password info, stored in data/init.json # Start service npm run service:start:daemon # Run in background (recommended) @@ -210,7 +210,7 @@ npm run service:status Browser visit: `http://your-server-IP:3000/web` -Default admin account: Look in data/Init.json +Default admin account: Look in data/init.json ### 2. Add Claude Account @@ -310,10 +310,16 @@ It's recommended to use nginx reverse proxy and configure SSL certificate: (The **1. Install nginx and obtain SSL certificate** ```bash # Ubuntu/Debian -sudo apt install nginx certbot python3-certbot-nginx +sudo apt install nginx + +# Install acme.sh +curl https://get.acme.sh | sh +source ~/.bashrc # Get free SSL certificate (using Let's Encrypt as example) -sudo certbot --nginx -d your-domain.com +acme.sh --issue -d your-domain.com --nginx +# Or use standalone mode +# acme.sh --issue -d your-domain.com --standalone ``` **2. nginx configuration example** diff --git a/src/services/claudeAccountService.js b/src/services/claudeAccountService.js index e4c67eb9..1d2a9ded 100644 --- a/src/services/claudeAccountService.js +++ b/src/services/claudeAccountService.js @@ -121,7 +121,10 @@ class ClaudeAccountService { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json, text/plain, */*', - 'User-Agent': 'claude-relay-service/1.0.0' + 'User-Agent': 'claude-cli/1.0.53 (external, cli)', + 'Accept-Language': 'en-US,en;q=0.9', + 'Referer': 'https://claude.ai/', + 'Origin': 'https://claude.ai' }, httpsAgent: agent, timeout: 30000 @@ -182,7 +185,7 @@ class ClaudeAccountService { const expiresAt = parseInt(accountData.expiresAt); const now = Date.now(); - if (!expiresAt || now >= (expiresAt - 10000)) { // 10秒提前刷新 + if (!expiresAt || now >= (expiresAt - 60000)) { // 60秒提前刷新 logger.info(`🔄 Token expired/expiring for account ${accountId}, attempting refresh...`); try { const refreshResult = await this.refreshAccountToken(accountId);