mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
fix: 修复 ESLint 代码质量问题
- 修复正则表达式中不必要的转义字符 - 使用对象解构优化代码风格 - 修复未使用变量的命名规范 - 确保所有修改文件通过 ESLint 检查 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,7 @@ const config = {
|
|||||||
description: 'Official Claude Code CLI',
|
description: 'Official Claude Code CLI',
|
||||||
// 匹配 Claude CLI 的 User-Agent
|
// 匹配 Claude CLI 的 User-Agent
|
||||||
// 示例: claude-cli/1.0.58 (external, cli)
|
// 示例: claude-cli/1.0.58 (external, cli)
|
||||||
userAgentPattern: /^claude-cli\/[\d\.]+\s+\(/i
|
userAgentPattern: /^claude-cli\/[\d.]+\s+\(/i
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'gemini_cli',
|
id: 'gemini_cli',
|
||||||
@@ -111,7 +111,7 @@ const config = {
|
|||||||
description: 'Gemini Command Line Interface',
|
description: 'Gemini Command Line Interface',
|
||||||
// 匹配 GeminiCLI 的 User-Agent
|
// 匹配 GeminiCLI 的 User-Agent
|
||||||
// 示例: GeminiCLI/v18.20.8 (darwin; arm64)
|
// 示例: GeminiCLI/v18.20.8 (darwin; arm64)
|
||||||
userAgentPattern: /^GeminiCLI\/v?[\d\.]+\s+\(/i
|
userAgentPattern: /^GeminiCLI\/v?[\d.]+\s+\(/i
|
||||||
}
|
}
|
||||||
// 添加自定义客户端示例:
|
// 添加自定义客户端示例:
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -271,8 +271,8 @@ class Application {
|
|||||||
}
|
}
|
||||||
if (!version) {
|
if (!version) {
|
||||||
try {
|
try {
|
||||||
const packageJson = require('../package.json')
|
const { version: pkgVersion } = require('../package.json')
|
||||||
version = packageJson.version
|
version = pkgVersion
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ router.post('/test', authenticateAdmin, async (req, res) => {
|
|||||||
res.json({
|
res.json({
|
||||||
success: true,
|
success: true,
|
||||||
message: 'Webhook test successful',
|
message: 'Webhook test successful',
|
||||||
url: url
|
url
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
logger.warn(`❌ Webhook test failed for: ${url} - ${result.error}`)
|
logger.warn(`❌ Webhook test failed for: ${url} - ${result.error}`)
|
||||||
res.status(400).json({
|
res.status(400).json({
|
||||||
success: false,
|
success: false,
|
||||||
message: 'Webhook test failed',
|
message: 'Webhook test failed',
|
||||||
url: url,
|
url,
|
||||||
error: result.error
|
error: result.error
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ class ClaudeConsoleAccountService {
|
|||||||
platform: 'claude-console',
|
platform: 'claude-console',
|
||||||
status: 'blocked',
|
status: 'blocked',
|
||||||
errorCode: 'CLAUDE_CONSOLE_BLOCKED',
|
errorCode: 'CLAUDE_CONSOLE_BLOCKED',
|
||||||
reason: reason
|
reason
|
||||||
})
|
})
|
||||||
} catch (webhookError) {
|
} catch (webhookError) {
|
||||||
logger.error('Failed to send webhook notification:', webhookError)
|
logger.error('Failed to send webhook notification:', webhookError)
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ class WebhookNotifier {
|
|||||||
* 获取错误代码映射
|
* 获取错误代码映射
|
||||||
* @param {string} platform - 平台类型
|
* @param {string} platform - 平台类型
|
||||||
* @param {string} status - 状态
|
* @param {string} status - 状态
|
||||||
* @param {string} reason - 原因
|
* @param {string} _reason - 原因 (未使用)
|
||||||
*/
|
*/
|
||||||
_getErrorCode(platform, status, reason) {
|
_getErrorCode(platform, status, _reason) {
|
||||||
const errorCodes = {
|
const errorCodes = {
|
||||||
'claude-oauth': {
|
'claude-oauth': {
|
||||||
unauthorized: 'CLAUDE_OAUTH_UNAUTHORIZED',
|
unauthorized: 'CLAUDE_OAUTH_UNAUTHORIZED',
|
||||||
|
|||||||
Reference in New Issue
Block a user