Commit Graph

1 Commits

Author SHA1 Message Date
ZyphrZero
7a1815069a 🐛 fix(api): add Vercel serverless function for Bilibili search suggestions
- Create api/bilibili.ts to handle Bilibili API requests in production
  - Proxy requests to https://s.search.bilibili.com/main/suggest
  - Add proper headers (User-Agent, Referer) to avoid blocking
  - Set CORS headers and cache control (60s)
  - Handle errors gracefully with fallback response
- Update src/utils/suggestions.ts to detect environment
  - Use /bilibili (Vite proxy) in development
  - Use /api/bilibili (Vercel Function) in production
  - Check import.meta.env.DEV to determine environment

This fixes the 404 error in production where Vite proxy is not available.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 10:47:35 +08:00