refactor: 收口 V3 分层架构与插件兼容边界

This commit is contained in:
jxxghp
2026-08-18 13:22:02 +08:00
parent cca99bd421
commit 8472bcff43
274 changed files with 10730 additions and 6130 deletions
+11 -6
View File
@@ -1,7 +1,7 @@
import base64
import re
from datetime import datetime
from typing import Callable, Optional, Tuple, Union, Dict
from typing import Any, Callable, Optional, Tuple, Union, Dict
from urllib.parse import urljoin
from app.application.site.sites import SitesHelper # pylint: disable=no-name-in-module
@@ -11,9 +11,8 @@ from app.chain import ChainBase
from app.chain._interaction import InteractionChainMixin
from app.runtime.config import global_vars, settings
from app.runtime.events import Event, eventmanager
from app.db.models.site import Site
from app.db.oper.site import SiteOper
from app.db.oper.systemconfig import SystemConfigOper
from app.application.chain.data import SitePortProxy as SiteOper
from app.application.configuration import get_configured_system_config
from app.adapters.network.browser import PlaywrightHelper
from app.adapters.network.cloudflare import under_challenge
from app.application.security.cookie import CookieHelper
@@ -32,6 +31,8 @@ from app.foundation import size as size_tools
from app.foundation import url as url_tools
from app.foundation.dom import DomUtils
Site = Any
class SiteChain(InteractionChainMixin, ChainBase):
"""
@@ -640,7 +641,7 @@ class SiteChain(InteractionChainMixin, ChainBase):
# 获取主域名中间那段
domain_host = url_tools.host_label(domain)
# 查询以"site.domain_host"开头的配置项,并清除
systemconfig = SystemConfigOper()
systemconfig = get_configured_system_config()
site_keys = systemconfig.all().keys()
for key in site_keys:
if key.startswith(f"site.{domain_host}"):
@@ -751,7 +752,11 @@ class SiteChain(InteractionChainMixin, ChainBase):
def _interaction_handler(self) -> "SiteInteractionHandler":
"""构造 /sites 交互处理器,Cookie 更新动作由本链提供。"""
return SiteInteractionHandler(messenger=self, cookie_updater=self.update_cookie)
return SiteInteractionHandler(
messenger=self,
cookie_updater=self.update_cookie,
repository=SiteOper(),
)
def remote_disable(self, arg_str: str, channel: NotificationChannel,
userid: Union[str, int] = None, source: Optional[str] = None):