fix(frontend): support cookie_bundle candidate in AuthCaptureDialog and refreshAuth

This commit is contained in:
liumangmang
2026-06-02 09:52:43 +08:00
parent 4f9acdc99c
commit b77ea21ca8
4 changed files with 45 additions and 9 deletions
+18 -1
View File
@@ -463,11 +463,28 @@ function openAuthCapture() {
authCaptureVisible.value = true
}
function handleAuthCaptureSelect(candidate: { type: string; value: string; cookie_name?: string; cookie_value?: string; new_api_user?: string }) {
function handleAuthCaptureSelect(candidate: {
type: string
value: string
cookie_name?: string
cookie_value?: string
cookie_count?: number
cookie_names?: string[]
new_api_user?: string
}) {
if (candidate.type === 'bearer_token') {
form.value.auth_type = 'bearer'
form.value.auth_config.token = candidate.value
ElMessage.success('已填入 Bearer Token')
} else if (candidate.type === 'cookie_bundle') {
// 完整 cookie 组:value 已是完整 "name1=v1; name2=v2" 字符串
form.value.auth_type = 'cookie'
form.value.auth_config.cookie_string = candidate.value
if (candidate.new_api_user) {
form.value.auth_config.new_api_user = candidate.new_api_user
}
const countLabel = candidate.cookie_count ? `${candidate.cookie_count} 个 cookie` : ''
ElMessage.success(`已填入完整 Cookie 组${countLabel}`)
} else if (candidate.type === 'cookie') {
form.value.auth_type = 'cookie'
form.value.auth_config.cookie_string = candidate.cookie_name && candidate.cookie_value