mirror of
https://github.com/yyhuni/xingrin.git
synced 2026-01-31 11:46:16 +08:00
- Add comprehensive mock data configuration for all major entities (dashboard, endpoints, organizations, scans, subdomains, targets, vulnerabilities, websites) - Implement mock service layer with centralized config for development and testing - Add vulnerability detail dialog integration to search results with lazy loading - Enhance search result card with vulnerability viewing capability - Update search materialized view migration to include vulnerability name field - Implement default host fuzzy search fallback for bare text queries without operators - Add vulnerability data formatting in search view for consistent API response structure - Configure Vercel deployment settings and update Next.js configuration - Update all service layers to support mock data injection for development environment - Extend search types with improved vulnerability data structure - Add internationalization strings for vulnerability loading errors - Enable rapid frontend development and testing without backend API dependency
24 lines
647 B
TypeScript
24 lines
647 B
TypeScript
/**
|
||
* Mock 数据配置
|
||
*
|
||
* 使用方式:
|
||
* 1. 在 .env.local 中设置 NEXT_PUBLIC_USE_MOCK=true 启用 mock 数据
|
||
* 2. 或者直接修改下面的 FORCE_MOCK 为 true
|
||
*/
|
||
|
||
// 强制使用 mock 数据(一般保持 false,通过环境变量控制)
|
||
const FORCE_MOCK = false
|
||
|
||
// 从环境变量读取 mock 配置
|
||
export const USE_MOCK = FORCE_MOCK || process.env.NEXT_PUBLIC_USE_MOCK === 'true'
|
||
|
||
// Mock 数据延迟(模拟网络请求)
|
||
export const MOCK_DELAY = 300 // ms
|
||
|
||
/**
|
||
* 模拟网络延迟
|
||
*/
|
||
export function mockDelay(ms: number = MOCK_DELAY): Promise<void> {
|
||
return new Promise(resolve => setTimeout(resolve, ms))
|
||
}
|