- 资源包升级以提升安全性
- 优化了页面数据刷新机制

注意:本次升级后会默认清理一次种子识别缓存
This commit is contained in:
jxxghp
2025-02-14 19:35:49 +08:00
parent aa1557ad9e
commit b8f4cd5fea
6 changed files with 118 additions and 5 deletions

View File

@@ -1,6 +1,25 @@
class BaseAction:
from abc import ABC, abstractmethod
from pydantic.main import BaseModel
from app.schemas import ActionContext
class BaseAction(BaseModel, ABC):
"""
工作流动作基类
"""
async def execute(self, params: dict, context: dict) -> dict:
@property
@abstractmethod
def name(self) -> str:
pass
@property
@abstractmethod
def description(self) -> str:
pass
@abstractmethod
async def execute(self, params: dict, context: ActionContext) -> ActionContext:
raise NotImplementedError

View File

@@ -76,7 +76,7 @@ class ChainBase(metaclass=ABCMeta):
"""
cache_path = settings.TEMP_PATH / filename
if cache_path.exists():
Path(cache_path).unlink()
cache_path.unlink()
def run_module(self, method: str, *args, **kwargs) -> Any:
"""

View File

@@ -0,0 +1,35 @@
from datetime import datetime
from sqlalchemy import Column, Integer, JSON, Sequence, String
from app.db import Base
class Workflow(Base):
"""
工作流表
"""
# ID
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
# 名称
name = Column(String, index=True, nullable=False)
# 描述
description = Column(String)
# 定时器
timer = Column(String)
# 状态N-新建 R-运行中 P-暂停 S-成功 F-失败
state = Column(String, nullable=False, index=True, default='N')
# 当前执行动作
current_action = Column(String)
# 任务执行结果
result = Column(String)
# 已执行次数
run_count = Column(Integer, default=0)
# 任务列表
actions = Column(JSON, default=list)
# 执行上下文
context = Column(JSON, default=dict)
# 创建时间
add_time = Column(String, default=datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
# 最后执行时间
last_time = Column(String)

View File

@@ -0,0 +1,35 @@
from abc import ABC, abstractmethod
from typing import Optional
from pydantic import BaseModel, Field
class Workflow(BaseModel):
"""
工作流信息
"""
name: Optional[str] = Field(None, description="工作流名称")
description: Optional[str] = Field(None, description="工作流描述")
timer: Optional[str] = Field(None, description="定时器")
state: Optional[str] = Field(None, description="状态")
current_action: Optional[str] = Field(None, description="当前执行动作")
result: Optional[str] = Field(None, description="任务执行结果")
run_count: Optional[int] = Field(0, description="已执行次数")
actions: Optional[list] = Field([], description="任务列表")
add_time: Optional[str] = Field(None, description="创建时间")
last_time: Optional[str] = Field(None, description="最后执行时间")
class Action(BaseModel):
"""
动作信息
"""
name: Optional[str] = Field(None, description="动作名称")
description: Optional[str] = Field(None, description="动作描述")
class ActionContext(BaseModel, ABC):
"""
动作上下文
"""
pass

View File

@@ -0,0 +1,24 @@
"""2.1.1
Revision ID: 279a949d81b6
Revises: ca5461f314f2
Create Date: 2025-02-14 19:02:24.989349
"""
from app.chain.torrents import TorrentsChain
# revision identifiers, used by Alembic.
revision = '279a949d81b6'
down_revision = 'ca5461f314f2'
branch_labels = None
depends_on = None
def upgrade() -> None:
# 清理一次缓存
TorrentsChain().clear_torrents()
def downgrade() -> None:
pass

View File

@@ -1,2 +1,2 @@
APP_VERSION = 'v2.2.8-1'
FRONTEND_VERSION = 'v2.2.8-1'
APP_VERSION = 'v2.2.9'
FRONTEND_VERSION = 'v2.2.9'