refactor: OpenAPI URL 抓取改为前端执行 + 服务端 CORS 代理

- 前端直接 fetch URL 支持 localhost/内网地址
- CORS 失败自动回退到服务端代理 /api/fetch-spec
- 添加 js-yaml 支持 YAML 格式解析
- 服务端移除 specUrl 参数,只接收已解析的 spec 对象

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 19:28:53 +08:00
parent 49ca1f6e1f
commit f3fbd3876a
11 changed files with 95 additions and 24 deletions

View File

@@ -1,9 +1,9 @@
import { useState, useRef, useCallback } from 'react';
import { useState, useRef, useCallback, type ReactNode } from 'react';
import { useTheme } from '../lib/theme';
import { useI18n, type TranslationKey } from '../lib/i18n';
import { useClickOutside } from '../hooks/useClickOutside';
const themes: Array<{ key: 'light' | 'dark' | 'system'; icon: JSX.Element }> = [
const themes: Array<{ key: 'light' | 'dark' | 'system'; icon: ReactNode }> = [
{
key: 'light',
icon: (