mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
refactor: 移除 KeyFormDialog 中的 OAuth 认证逻辑
OAuth 流程已由独立的 OAuthAccountDialog 处理,移除 KeyFormDialog 中冗余的 OAuth 表单、授权流程 UI 和状态管理代码。同时清理 provider_oauth.ts 中不再 使用的接口和函数,修复 ProviderOAuthCompleteRequest 重复声明问题。
This commit is contained in:
@@ -1,15 +1,5 @@
|
||||
import client from '../client'
|
||||
|
||||
export interface ProviderOAuthSupportedType {
|
||||
provider_type: string
|
||||
display_name: string
|
||||
scopes: string[]
|
||||
redirect_uri: string
|
||||
authorize_url: string
|
||||
token_url: string
|
||||
use_pkce: boolean
|
||||
}
|
||||
|
||||
export interface ProviderOAuthStartResponse {
|
||||
authorization_url: string
|
||||
redirect_uri: string
|
||||
@@ -19,6 +9,7 @@ export interface ProviderOAuthStartResponse {
|
||||
|
||||
export interface ProviderOAuthCompleteRequest {
|
||||
callback_url: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
export interface ProviderOAuthCompleteResponse {
|
||||
@@ -28,22 +19,12 @@ export interface ProviderOAuthCompleteResponse {
|
||||
email?: string | null
|
||||
}
|
||||
|
||||
export async function getProviderOAuthSupportedTypes(): Promise<ProviderOAuthSupportedType[]> {
|
||||
const resp = await client.get('/api/admin/provider-oauth/supported-types')
|
||||
return resp.data
|
||||
}
|
||||
|
||||
export async function startProviderOAuth(keyId: string): Promise<ProviderOAuthStartResponse> {
|
||||
const resp = await client.post(`/api/admin/provider-oauth/keys/${keyId}/start`)
|
||||
return resp.data
|
||||
}
|
||||
|
||||
export async function completeProviderOAuth(
|
||||
keyId: string,
|
||||
data: ProviderOAuthCompleteRequest
|
||||
): Promise<ProviderOAuthCompleteResponse> {
|
||||
const resp = await client.post(`/api/admin/provider-oauth/keys/${keyId}/complete`, data)
|
||||
return resp.data
|
||||
export interface ProviderOAuthCompleteResponseWithKey {
|
||||
key_id: string
|
||||
provider_type: string
|
||||
expires_at?: number | null
|
||||
has_refresh_token: boolean
|
||||
email?: string | null
|
||||
}
|
||||
|
||||
export async function refreshProviderOAuth(keyId: string): Promise<ProviderOAuthCompleteResponse> {
|
||||
@@ -53,19 +34,6 @@ export async function refreshProviderOAuth(keyId: string): Promise<ProviderOAuth
|
||||
|
||||
// Provider-level OAuth (不需要预先创建 key)
|
||||
|
||||
export interface ProviderOAuthCompleteRequest {
|
||||
callback_url: string
|
||||
name?: string
|
||||
}
|
||||
|
||||
export interface ProviderOAuthCompleteResponseWithKey {
|
||||
key_id: string
|
||||
provider_type: string
|
||||
expires_at?: number | null
|
||||
has_refresh_token: boolean
|
||||
email?: string | null
|
||||
}
|
||||
|
||||
export async function startProviderLevelOAuth(providerId: string): Promise<ProviderOAuthStartResponse> {
|
||||
const resp = await client.post(`/api/admin/provider-oauth/providers/${providerId}/start`)
|
||||
return resp.data
|
||||
|
||||
Reference in New Issue
Block a user