mirror of
https://github.com/jxxghp/MoviePilot-Plugins.git
synced 2026-06-04 07:26:50 +00:00
- 优化插件目录结构和数据结构, 解耦API层和服务层 - 添加了一些Pydantic模型, 用于校验配置 - 支持独立的订阅链接配置 - 新增覆写代理组和出站代理操作 - 支持 smart 组和代理集合 - 代理组回环检测 - 使用异步调度器 - 显示规则更改日期 - 完善了对嵌套逻辑规则和子规则的配置和验证
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
from abc import ABC
|
|
from typing import Final, Optional, Literal, Dict
|
|
|
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
|
|
|
from app.plugins import _PluginBase
|
|
|
|
from .config import PluginConfig
|
|
from .state import PluginState
|
|
from .store import PluginStore
|
|
|
|
|
|
class _ClashRuleProviderBase(_PluginBase, ABC):
|
|
# Constants
|
|
DEFAULT_CLASH_CONF: Final[
|
|
Dict[Literal['rules', 'rule-providers', 'proxies', 'proxy-groups', 'proxy-providers'], dict | list]] = {
|
|
'rules': [], 'rule-providers': {},
|
|
'proxies': [], 'proxy-groups': [], 'proxy-providers': {}
|
|
}
|
|
OVERWRITTEN_PROXIES_LIFETIME: Final[int] = 10
|
|
ACL4SSR_API: Final[str] = "https://api.github.com/repos/ACL4SSR/ACL4SSR"
|
|
METACUBEX_RULE_DAT_API: Final[str] = "https://api.github.com/repos/MetaCubeX/meta-rules-dat"
|
|
MISFIRE_GRACE_TIME: Final[int] = 120
|
|
KEY_TOP_RULES: Final[str] = "top_rules"
|
|
KEY_RULESET_RULES: Final[str] = "ruleset_rules"
|
|
KEY_PROXIES: Final[str] = "proxies"
|
|
KEY_PROXY_GROUPS: Final[str] = "proxy-groups"
|
|
KEY_NAME: Final[str] = "name"
|
|
|
|
def __init__(self):
|
|
# Configuration attributes
|
|
super().__init__()
|
|
|
|
# Runtime variables
|
|
self.state: Optional[PluginState] = None
|
|
self.config: Optional[PluginConfig] = None
|
|
self.store: Optional[PluginStore] = None
|
|
self.scheduler: Optional[AsyncIOScheduler] = None
|