删除不支持的图形验证码类型

This commit is contained in:
灌糖包子 2026-05-15 22:52:26 +08:00
parent ee88c8abe9
commit 4c2d41b699
Signed by: sookie
GPG Key ID: 0599BECB75C1E68D

View File

@ -42,18 +42,15 @@ import {
type TianAiCaptchaInstance
} from '@/vendor/tianai-captcha'
type CaptchaType = 'RANDOM' | 'SLIDER' | 'ROTATE' | 'ROTATE_DEGREE' | 'CONCAT' | 'IMAGE_CLICK' | 'WORD_IMAGE_CLICK'
type CaptchaType = 'RANDOM' | 'SLIDER' | 'ROTATE' | 'CONCAT' | 'WORD_IMAGE_CLICK'
const baseApiUrl = import.meta.env.VITE_APP_API_BASE
const requestCaptchaBaseUrl = buildApiUrl(baseApiUrl, '/captcha/gen')
const validCaptchaUrl = buildApiUrl(baseApiUrl, '/captcha/check')
const requestCaptchaBaseUrl = buildApiUrl('/captcha/gen')
const validCaptchaUrl = buildApiUrl('/captcha/check')
const captchaTypeOptions: Array<{ label: string, value: CaptchaType }> = [
{ label: '随机', value: 'RANDOM' },
{ label: '滑块拼图', value: 'SLIDER' },
{ label: '旋转', value: 'ROTATE' },
{ label: '旋转(角度)', value: 'ROTATE_DEGREE' },
{ label: '拼接', value: 'CONCAT' },
{ label: '点选', value: 'IMAGE_CLICK' },
{ label: '汉字点选', value: 'WORD_IMAGE_CLICK' },
]
@ -128,14 +125,9 @@ function destroyCaptcha(showMessage = true) {
}
}
function buildApiUrl(base: string | undefined, path: string) {
const normalizedBase = (base || '').replace(/\/+$/, '')
function buildApiUrl(path: string) {
const normalizedBase = (import.meta.env.VITE_APP_API_BASE || '').replace(/\/+$/, '')
const normalizedPath = path.startsWith('/') ? path : `/${path}`
if (!normalizedBase) {
return `/api/v2${normalizedPath}`
}
return `${normalizedBase}${normalizedPath}`
}