mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
feat: 完全移除 API Key 图标功能
彻底删除 API Key 图标功能的所有相关代码: 前端改动: - 删除 IconPicker.vue 组件文件 - 移除 ApiKeysView.vue 中的图标显示和 updateApiKeyIcon 方法 - 清理 CreateApiKeyModal.vue 中的图标选择器 - 清理 EditApiKeyModal.vue 中的图标选择器 - 移除所有 IconPicker 组件的引用 后端改动: - 从 apiKeyService.js 中移除 icon 字段更新支持 - 从 admin.js 路由中移除 icon 参数处理和验证逻辑 - 清理创建和更新 API Key 时的 icon 参数 此改动简化了 API Key 管理界面,移除了不必要的图标功能。 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -534,8 +534,7 @@ router.post('/api-keys', authenticateAdmin, async (req, res) => {
|
||||
weeklyOpusCostLimit,
|
||||
tags,
|
||||
activationDays, // 新增:激活后有效天数
|
||||
expirationMode, // 新增:过期模式
|
||||
icon // 新增:图标(base64编码)
|
||||
expirationMode // 新增:过期模式
|
||||
} = req.body
|
||||
|
||||
// 输入验证
|
||||
@@ -989,8 +988,7 @@ router.put('/api-keys/:keyId', authenticateAdmin, async (req, res) => {
|
||||
dailyCostLimit,
|
||||
weeklyOpusCostLimit,
|
||||
tags,
|
||||
ownerId, // 新增:所有者ID字段
|
||||
icon // 新增:图标(base64编码)
|
||||
ownerId // 新增:所有者ID字段
|
||||
} = req.body
|
||||
|
||||
// 只允许更新指定字段
|
||||
@@ -1164,19 +1162,6 @@ router.put('/api-keys/:keyId', authenticateAdmin, async (req, res) => {
|
||||
updates.tags = tags
|
||||
}
|
||||
|
||||
// 处理图标
|
||||
if (icon !== undefined) {
|
||||
// icon 可以是空字符串(清除图标)或 base64 编码的字符串
|
||||
if (icon !== '' && typeof icon !== 'string') {
|
||||
return res.status(400).json({ error: 'Icon must be a string' })
|
||||
}
|
||||
// 简单验证 base64 格式(如果不为空)
|
||||
if (icon && !icon.startsWith('data:image/')) {
|
||||
return res.status(400).json({ error: 'Icon must be a valid base64 image' })
|
||||
}
|
||||
updates.icon = icon
|
||||
}
|
||||
|
||||
// 处理活跃/禁用状态状态, 放在过期处理后,以确保后续增加禁用key功能
|
||||
if (isActive !== undefined) {
|
||||
if (typeof isActive !== 'boolean') {
|
||||
|
||||
@@ -412,8 +412,7 @@ class ApiKeyService {
|
||||
'tags',
|
||||
'userId', // 新增:用户ID(所有者变更)
|
||||
'userUsername', // 新增:用户名(所有者变更)
|
||||
'createdBy', // 新增:创建者(所有者变更)
|
||||
'icon' // 新增:图标(base64编码)
|
||||
'createdBy' // 新增:创建者(所有者变更)
|
||||
]
|
||||
const updatedData = { ...keyData }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user