feat: 初始化项目,支持流式搜索与限流

*   初始化项目结构,包括配置、依赖和忽略文件。
*   引入核心搜索逻辑,支持流式响应以提供实时进度。
*   抽象化平台接口,并集成多个Galgame和补丁搜索源。
*   实现基于IP的速率限制功能,利用Cloudflare KV存储。
*   新增自动化脚本,用于生成平台索引文件。
*   统一HTTP请求客户端,增加超时和自定义User-Agent。
*   为部分平台添加了对`zypassword`参数的支持。
This commit is contained in:
Jurangren
2025-08-21 21:22:54 +08:00
parent 6708dcc84f
commit 83661b404a
47 changed files with 4338 additions and 0 deletions

34
src/types.ts Normal file
View File

@@ -0,0 +1,34 @@
// 单个搜索结果
export interface SearchResultItem {
name: string;
url: string;
}
// 平台搜索的返回值
export interface PlatformSearchResult {
items: SearchResultItem[];
count: number;
name: string;
error?: string;
}
// 平台对象的接口
export interface Platform {
name: string;
color: string;
magic: boolean;
search: (game: string, ...args: any[]) => Promise<PlatformSearchResult>;
}
// SSE 事件流中的数据结构
export interface StreamResult {
name: string;
color: string;
items: SearchResultItem[];
error?: string;
}
export interface StreamProgress {
completed: number;
total: number;
}