diff --git a/DESIGN.md b/DESIGN.md index 576c75c..84b08f6 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -309,77 +309,87 @@ Store 只负责: ``` ProxyPool/ -├── api/ # FastAPI 入口和路由 -│ ├── __init__.py -│ ├── main.py # 应用工厂 -│ ├── lifespan.py # 生命周期管理 -│ ├── deps.py # 依赖注入 -│ ├── errors.py # 统一异常 -│ └── routes/ -│ ├── __init__.py -│ ├── proxies.py -│ ├── plugins.py -│ ├── scheduler.py -│ └── settings.py +├── main.py # 项目入口 +├── requirements.txt # Python 依赖 +├── .env.example # 环境变量示例 │ -├── core/ # 基础设施 -│ ├── __init__.py -│ ├── config.py # Pydantic Settings -│ ├── log.py # 日志 -│ ├── db.py # 数据库连接池/上下文 -│ └── exceptions.py # 业务异常 -│ -├── models/ # 数据模型 -│ ├── __init__.py -│ ├── schemas.py # Pydantic 模型 -│ └── domain.py # 领域模型(ProxyRaw, PluginInfo 等) -│ -├── repositories/ # 数据访问层 -│ ├── __init__.py -│ └── proxy_repo.py # ProxyRepository -│ -├── services/ # 业务逻辑层 -│ ├── __init__.py -│ ├── proxy_service.py -│ ├── plugin_service.py -│ ├── scheduler_service.py -│ └── validator_service.py -│ -├── core/ # 任务与插件系统 -│ ├── plugin_system/ +├── app/ # 后端代码 +│ ├── api/ # FastAPI 入口和路由 │ │ ├── __init__.py -│ │ ├── base.py # BaseCrawlerPlugin -│ │ └── registry.py # 插件注册中心 -│ └── tasks/ +│ │ ├── main.py # 应用工厂 +│ │ ├── lifespan.py # 生命周期管理 +│ │ ├── deps.py # 依赖注入 +│ │ ├── errors.py # 统一异常 +│ │ └── routes/ +│ │ ├── __init__.py +│ │ ├── proxies.py +│ │ ├── plugins.py +│ │ ├── scheduler.py +│ │ └── settings.py +│ │ +│ ├── core/ # 基础设施 +│ │ ├── __init__.py +│ │ ├── config.py # Pydantic Settings +│ │ ├── log.py # 日志 +│ │ ├── db.py # 数据库连接池/上下文 +│ │ ├── exceptions.py # 业务异常 +│ │ ├── plugin_system/ # 插件系统 +│ │ │ ├── __init__.py +│ │ │ ├── base.py # BaseCrawlerPlugin +│ │ │ └── registry.py # 插件注册中心 +│ │ └── tasks/ # 任务队列 +│ │ ├── __init__.py +│ │ └── queue.py # ValidationQueue +│ │ +│ ├── models/ # 数据模型 +│ │ ├── __init__.py +│ │ ├── schemas.py # Pydantic 模型 +│ │ └── domain.py # 领域模型 +│ │ +│ ├── repositories/ # 数据访问层 +│ │ ├── __init__.py +│ │ ├── proxy_repo.py +│ │ ├── settings_repo.py +│ │ └── task_repo.py +│ │ +│ ├── services/ # 业务逻辑层 +│ │ ├── __init__.py +│ │ ├── proxy_service.py +│ │ ├── plugin_service.py +│ │ ├── scheduler_service.py +│ │ └── validator_service.py +│ │ +│ └── plugins/ # 爬虫插件 │ ├── __init__.py -│ ├── queue.py # ValidationQueue -│ └── workers.py # Worker Pool +│ ├── base.py # 通用抓取基类 +│ ├── fate0.py +│ ├── kuaidaili.py +│ ├── ip3366.py +│ ├── ip89.py +│ ├── speedx.py +│ ├── yundaili.py +│ ├── proxylist_download.py +│ └── proxyscrape.py │ -├── plugins/ # 爬虫插件 -│ ├── __init__.py -│ ├── base.py # 通用抓取基类(HTTP 请求封装) -│ ├── fate0.py -│ ├── proxylist_download.py -│ └── ... -│ -├── frontend/ # Vue3 前端 -│ └── src/ -│ ├── services/ # 新增 -│ ├── stores/ -│ ├── api/ -│ └── ... +├── WebUI/ # Vue3 前端 +│ ├── src/ +│ │ ├── api/ # API 封装 +│ │ ├── stores/ # Pinia 状态管理 +│ │ ├── views/ # 页面组件 +│ │ ├── router/ # 路由配置 +│ │ ├── components/ # 通用组件 +│ │ └── style.css # 全局样式 +│ ├── index.html +│ └── package.json │ ├── tests/ # 测试目录 │ ├── conftest.py │ ├── unit/ │ └── integration/ │ -├── script/ -├── data/ -├── db/ -├── logs/ -├── requirements.txt -├── .env.example +├── script/ # 启动脚本 +├── db/ # 数据存储 +├── logs/ # 日志文件 └── DESIGN.md # 本文档 ``` @@ -426,11 +436,11 @@ ProxyPool/ 假设要添加一个名为 `mynewsource` 的爬虫: -**Step 1**: 创建文件 `plugins/mynewsource.py` +**Step 1**: 创建文件 `app/plugins/mynewsource.py` ```python -from core.plugin_system import BaseCrawlerPlugin, ProxyRaw -from plugins.base import BaseHTTPPlugin # 可选:如果基于 HTTP 爬取 +from app.core.plugin_system import BaseCrawlerPlugin, ProxyRaw +from app.plugins.base import BaseHTTPPlugin # 可选:如果基于 HTTP 爬取 class MyNewSourcePlugin(BaseHTTPPlugin): name = "mynewsource" @@ -450,11 +460,11 @@ class MyNewSourcePlugin(BaseHTTPPlugin): return results ``` -**Step 2**: 在 `plugins/__init__.py` 中注册 +**Step 2**: 在 `app/plugins/__init__.py` 中注册 ```python from .mynewsource import MyNewSourcePlugin -from core.plugin_system import registry +from app.core.plugin_system import registry registry.register(MyNewSourcePlugin) ``` diff --git a/README.md b/README.md index ca1069c..f69e1e3 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ pip install -r requirements.txt ### 2. 安装前端依赖 ```bash -cd frontend +cd WebUI npm install ``` @@ -58,7 +58,7 @@ python api_server.py **启动前端服务**(终端 2) ```bash -cd frontend +cd WebUI npm run dev ``` @@ -77,32 +77,35 @@ stop.bat ``` ProxyPool/ -├── api_server.py # FastAPI 后端服务器 -├── config.py # 配置文件 +├── main.py # 项目入口 ├── requirements.txt # Python 依赖 ├── .env.example # 环境变量示例 │ -├── script/ # 启动脚本 -│ ├── start.bat # Windows 启动脚本 -│ └── stop.bat # Windows 停止脚本 +├── app/ # 后端代码 +│ ├── api/ # FastAPI 路由 +│ │ ├── main.py # 应用工厂 +│ │ ├── routes/ # API 路由 +│ │ ├── deps.py # 依赖注入 +│ │ └── ... +│ ├── core/ # 核心模块 +│ │ ├── config.py # 配置管理 +│ │ ├── db.py # 数据库连接 +│ │ ├── log.py # 日志配置 +│ │ ├── plugin_system/ # 插件系统 +│ │ └── tasks/ # 任务队列 +│ ├── models/ # 数据模型 +│ ├── repositories/ # 数据访问层 +│ ├── services/ # 业务逻辑层 +│ └── plugins/ # 代理源插件 +│ ├── fate0.py # Fate0 代理源 +│ ├── ip3366.py # IP3366 代理源 +│ ├── ip89.py # IP89 代理源 +│ ├── kuaidaili.py # 快代理源 +│ ├── yundaili.py # 云代理源 +│ ├── speedx.py # SpeedX 代理源 +│ └── proxylist_download.py # ProxyList 代理源 │ -├── core/ # 核心模块 -│ ├── crawler.py # 爬虫基类 -│ ├── validator.py # 代理验证器 -│ ├── sqlite.py # 数据库管理 -│ ├── plugin_manager.py # 插件管理器 -│ └── log.py # 日志配置 -│ -├── plugins/ # 代理源插件 -│ ├── fate0.py # Fate0 代理源 -│ ├── ip3366.py # IP3366 代理源 -│ ├── ip89.py # IP89 代理源 -│ ├── kuaidaili.py # 快代理源 -│ ├── yundaili.py # 云代理源 -│ ├── speedx.py # SpeedX 代理源 -│ └── proxylist_download.py # ProxyList 代理源 -│ -├── frontend/ # Vue3 前端 +├── WebUI/ # Vue3 前端 │ ├── src/ │ │ ├── api/ # API 封装 │ │ ├── stores/ # Pinia 状态管理 @@ -113,6 +116,10 @@ ProxyPool/ │ ├── index.html │ └── package.json │ +├── script/ # 启动脚本 +│ ├── start.bat # Windows 启动脚本 +│ └── stop.bat # Windows 停止脚本 +│ └── db/ # 数据存储目录 └── proxies.sqlite # SQLite 数据库 ``` diff --git a/frontend/.eslintrc.json b/WebUI/.eslintrc.json similarity index 100% rename from frontend/.eslintrc.json rename to WebUI/.eslintrc.json diff --git a/frontend/.gitignore b/WebUI/.gitignore similarity index 100% rename from frontend/.gitignore rename to WebUI/.gitignore diff --git a/frontend/.prettierrc.json b/WebUI/.prettierrc.json similarity index 100% rename from frontend/.prettierrc.json rename to WebUI/.prettierrc.json diff --git a/frontend/index.html b/WebUI/index.html similarity index 100% rename from frontend/index.html rename to WebUI/index.html diff --git a/frontend/package.json b/WebUI/package.json similarity index 100% rename from frontend/package.json rename to WebUI/package.json diff --git a/frontend/public/vite.svg b/WebUI/public/vite.svg similarity index 100% rename from frontend/public/vite.svg rename to WebUI/public/vite.svg diff --git a/frontend/src/App.vue b/WebUI/src/App.vue similarity index 100% rename from frontend/src/App.vue rename to WebUI/src/App.vue diff --git a/frontend/src/api/index.js b/WebUI/src/api/index.js similarity index 100% rename from frontend/src/api/index.js rename to WebUI/src/api/index.js diff --git a/frontend/src/components/PageHeader.vue b/WebUI/src/components/PageHeader.vue similarity index 100% rename from frontend/src/components/PageHeader.vue rename to WebUI/src/components/PageHeader.vue diff --git a/frontend/src/components/ProtocolChart.vue b/WebUI/src/components/ProtocolChart.vue similarity index 100% rename from frontend/src/components/ProtocolChart.vue rename to WebUI/src/components/ProtocolChart.vue diff --git a/frontend/src/components/QuickActions.vue b/WebUI/src/components/QuickActions.vue similarity index 100% rename from frontend/src/components/QuickActions.vue rename to WebUI/src/components/QuickActions.vue diff --git a/frontend/src/components/StatCard.vue b/WebUI/src/components/StatCard.vue similarity index 100% rename from frontend/src/components/StatCard.vue rename to WebUI/src/components/StatCard.vue diff --git a/frontend/src/main.js b/WebUI/src/main.js similarity index 100% rename from frontend/src/main.js rename to WebUI/src/main.js diff --git a/frontend/src/router/index.js b/WebUI/src/router/index.js similarity index 100% rename from frontend/src/router/index.js rename to WebUI/src/router/index.js diff --git a/frontend/src/services/pluginService.js b/WebUI/src/services/pluginService.js similarity index 100% rename from frontend/src/services/pluginService.js rename to WebUI/src/services/pluginService.js diff --git a/frontend/src/services/proxyService.js b/WebUI/src/services/proxyService.js similarity index 100% rename from frontend/src/services/proxyService.js rename to WebUI/src/services/proxyService.js diff --git a/frontend/src/services/schedulerService.js b/WebUI/src/services/schedulerService.js similarity index 100% rename from frontend/src/services/schedulerService.js rename to WebUI/src/services/schedulerService.js diff --git a/frontend/src/services/settingService.js b/WebUI/src/services/settingService.js similarity index 100% rename from frontend/src/services/settingService.js rename to WebUI/src/services/settingService.js diff --git a/frontend/src/stores/plugins.js b/WebUI/src/stores/plugins.js similarity index 100% rename from frontend/src/stores/plugins.js rename to WebUI/src/stores/plugins.js diff --git a/frontend/src/stores/proxy.js b/WebUI/src/stores/proxy.js similarity index 100% rename from frontend/src/stores/proxy.js rename to WebUI/src/stores/proxy.js diff --git a/frontend/src/style.css b/WebUI/src/style.css similarity index 100% rename from frontend/src/style.css rename to WebUI/src/style.css diff --git a/frontend/src/styles/element-plus.css b/WebUI/src/styles/element-plus.css similarity index 100% rename from frontend/src/styles/element-plus.css rename to WebUI/src/styles/element-plus.css diff --git a/frontend/src/styles/utilities.css b/WebUI/src/styles/utilities.css similarity index 100% rename from frontend/src/styles/utilities.css rename to WebUI/src/styles/utilities.css diff --git a/frontend/src/styles/variables.css b/WebUI/src/styles/variables.css similarity index 100% rename from frontend/src/styles/variables.css rename to WebUI/src/styles/variables.css diff --git a/frontend/src/utils/clipboard.js b/WebUI/src/utils/clipboard.js similarity index 100% rename from frontend/src/utils/clipboard.js rename to WebUI/src/utils/clipboard.js diff --git a/frontend/src/utils/confirm.js b/WebUI/src/utils/confirm.js similarity index 100% rename from frontend/src/utils/confirm.js rename to WebUI/src/utils/confirm.js diff --git a/frontend/src/utils/format.js b/WebUI/src/utils/format.js similarity index 100% rename from frontend/src/utils/format.js rename to WebUI/src/utils/format.js diff --git a/frontend/src/utils/message.js b/WebUI/src/utils/message.js similarity index 100% rename from frontend/src/utils/message.js rename to WebUI/src/utils/message.js diff --git a/frontend/src/views/Dashboard.vue b/WebUI/src/views/Dashboard.vue similarity index 100% rename from frontend/src/views/Dashboard.vue rename to WebUI/src/views/Dashboard.vue diff --git a/frontend/src/views/Plugins.vue b/WebUI/src/views/Plugins.vue similarity index 71% rename from frontend/src/views/Plugins.vue rename to WebUI/src/views/Plugins.vue index 97cf040..8874b83 100644 --- a/frontend/src/views/Plugins.vue +++ b/WebUI/src/views/Plugins.vue @@ -74,26 +74,42 @@ - + @@ -104,28 +120,28 @@ :image-size="120" /> - + -