diff --git a/src/views/debug/CaptchaSandbox.vue b/src/views/debug/CaptchaSandbox.vue index 8d8ea2f..18b364f 100644 --- a/src/views/debug/CaptchaSandbox.vue +++ b/src/views/debug/CaptchaSandbox.vue @@ -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}` }