fix: enforce Heicode-only login and remove ClawdRouter enum residue
Backend listLoginProviders() was iterating ['taijiaicloud','clawdrouter'] and throwing 500 because clawdrouter preset was already removed from providerPresets.json. Narrowing SUPPORTED_LOGIN_PROVIDER_IDS and the two Zod enums to ['taijiaicloud'] only, plus tightening the desktop HeicodeProviderId type to match. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// desktop/src/api/heicodeAuth.ts
|
||||
//
|
||||
// HeiCode 双 Provider 登录后端的客户端封装。
|
||||
// Heicode 单 Provider 登录后端的客户端封装。
|
||||
// 对应路由: src/server/api/heicode-auth.ts
|
||||
|
||||
import { api } from './client'
|
||||
|
||||
export type HeicodeProviderId = 'taijiaicloud' | 'clawdrouter'
|
||||
export type HeicodeProviderId = 'taijiaicloud'
|
||||
|
||||
export type HeicodeLoginProviderInfo = {
|
||||
id: HeicodeProviderId
|
||||
|
||||
@@ -38,7 +38,7 @@ import { ApiError, errorResponse } from '../middleware/errorHandler.js'
|
||||
|
||||
const providerService = new ProviderService()
|
||||
|
||||
const SUPPORTED_LOGIN_PROVIDER_IDS = ['taijiaicloud', 'clawdrouter'] as const
|
||||
const SUPPORTED_LOGIN_PROVIDER_IDS = ['taijiaicloud'] as const
|
||||
type SupportedLoginProviderId = (typeof SUPPORTED_LOGIN_PROVIDER_IDS)[number]
|
||||
|
||||
function isSupportedLoginProvider(id: string): id is SupportedLoginProviderId {
|
||||
@@ -46,13 +46,13 @@ function isSupportedLoginProvider(id: string): id is SupportedLoginProviderId {
|
||||
}
|
||||
|
||||
const LoginRequestSchema = z.object({
|
||||
providerId: z.enum(['taijiaicloud', 'clawdrouter']),
|
||||
providerId: z.enum(['taijiaicloud']),
|
||||
apiKey: z.string().min(8, 'API Key 长度过短'),
|
||||
displayName: z.string().min(1).optional(),
|
||||
})
|
||||
|
||||
const OAuthStartSchema = z.object({
|
||||
providerId: z.enum(['taijiaicloud', 'clawdrouter']),
|
||||
providerId: z.enum(['taijiaicloud']),
|
||||
})
|
||||
|
||||
type OAuthSession = {
|
||||
|
||||
Reference in New Issue
Block a user