mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
fix: 完善插件恢复与运行态收敛 (#6376)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from enum import Enum as _Enum
|
||||
from typing import Optional, List, Dict, Union
|
||||
|
||||
from pydantic import BaseModel, Field, RootModel
|
||||
@@ -5,6 +6,17 @@ from pydantic import BaseModel, Field, RootModel
|
||||
from app.schemas.common import JsonData
|
||||
|
||||
|
||||
class PluginRuntimeStatus(str, _Enum):
|
||||
"""插件从源码准备到运行激活的六类状态。"""
|
||||
|
||||
SOURCE_MISSING = "source_missing"
|
||||
DEPENDENCY_PENDING = "dependency_pending"
|
||||
READY = "ready"
|
||||
ACTIVE = "active"
|
||||
BLOCKED_BY_POLICY = "blocked_by_policy"
|
||||
LOAD_FAILED = "load_failed"
|
||||
|
||||
|
||||
class Plugin(BaseModel):
|
||||
"""
|
||||
插件信息
|
||||
@@ -34,6 +46,8 @@ class Plugin(BaseModel):
|
||||
installed: Optional[bool] = False
|
||||
# 运行状态
|
||||
state: Optional[bool] = False
|
||||
# 插件源码、依赖和运行时加载状态
|
||||
runtime_status: Optional[PluginRuntimeStatus] = None
|
||||
# 是否有详情页面
|
||||
has_page: Optional[bool] = False
|
||||
# 是否有新版本
|
||||
@@ -60,6 +74,15 @@ class Plugin(BaseModel):
|
||||
plugin_public_key: Optional[str] = None
|
||||
|
||||
|
||||
class PluginRuntimeSummary(BaseModel):
|
||||
"""插件后台收敛状态和前端刷新代次。"""
|
||||
|
||||
ready: bool = Field(description="本轮插件源码、依赖和加载是否已收敛")
|
||||
generation: int = Field(description="插件运行状态变化代次")
|
||||
pending_count: int = Field(description="仍处于准备阶段的插件数量")
|
||||
failed_count: int = Field(description="加载失败或被策略阻止的插件数量")
|
||||
|
||||
|
||||
class PluginDashboard(Plugin):
|
||||
"""
|
||||
插件仪表盘
|
||||
|
||||
Reference in New Issue
Block a user