mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 05:44:44 +08:00
fix(architecture): restore ratchet baselines without weakening gates
This commit is contained in:
6
app/adapters/external/plugin/client.py
vendored
6
app/adapters/external/plugin/client.py
vendored
@@ -26,10 +26,14 @@ from app.domain.plugin import (
|
||||
is_local_plugin_source,
|
||||
is_physical_plugin_id,
|
||||
is_plugin_generation_compatible,
|
||||
normalize_plugin_market_repo_url as _normalize_plugin_market_repo_url,
|
||||
parse_local_plugin_generation,
|
||||
parse_local_plugin_path,
|
||||
parse_local_plugin_reference,
|
||||
)
|
||||
from app.domain.plugin import (
|
||||
normalize_plugin_market_repo_url as _normalize_plugin_market_repo_url,
|
||||
)
|
||||
from app.domain.plugin import (
|
||||
split_plugin_market_repo_urls as _split_plugin_market_repo_urls,
|
||||
)
|
||||
from app.foundation.environment import is_free_threaded_runtime
|
||||
|
||||
@@ -470,16 +470,6 @@ class SiteChain(InteractionChainMixin, ChainBase):
|
||||
return False, "Cookie已过期"
|
||||
return False, f"错误:{res.status_code} {res.reason}"
|
||||
|
||||
@staticmethod
|
||||
def __resolve_site_page_url(site_url: str, page_path: Optional[str]) -> str:
|
||||
"""将站点资源声明的相对页面路径解析为绝对地址。"""
|
||||
page_path = str(page_path or "").strip()
|
||||
if not page_path:
|
||||
return site_url
|
||||
if page_path.startswith(("http://", "https://")):
|
||||
return page_path
|
||||
return urljoin(f"{str(site_url).rstrip('/')}/", page_path.lstrip("/"))
|
||||
|
||||
def __hddolby_test(self, site: SiteSnapshot) -> Tuple[bool, str]:
|
||||
"""
|
||||
判断站点是否已经登陆:hddolby
|
||||
@@ -693,7 +683,7 @@ class SiteChain(InteractionChainMixin, ChainBase):
|
||||
logger.warning(f"站点 {domain} 已在黑名单中,不添加站点")
|
||||
return 0, 0, 0, False
|
||||
domain_url = self._cookiecloud_indexer_domain(indexer, domain)
|
||||
login_url = self.__resolve_site_page_url(domain_url, indexer.get("login_path"))
|
||||
login_url = site_rules.resolve_page_url(domain_url, indexer.get("login_path"))
|
||||
proxy, response = self._cookiecloud_connect(login_url, cookie, indexer)
|
||||
if response is None:
|
||||
return 0, 0, 1, False
|
||||
@@ -886,16 +876,14 @@ class SiteChain(InteractionChainMixin, ChainBase):
|
||||
state, message = special_test(site_info)
|
||||
else:
|
||||
indexer = SitesHelper().get_indexer(domain) or {}
|
||||
login_path = indexer.get("login_path")
|
||||
if login_path:
|
||||
state, message = self.__test(
|
||||
replace(
|
||||
site_info,
|
||||
url=self.__resolve_site_page_url(site_info.url, login_path),
|
||||
)
|
||||
state, message = self.__test(
|
||||
replace(
|
||||
site_info,
|
||||
url=site_rules.resolve_page_url(
|
||||
site_info.url, indexer.get("login_path")
|
||||
),
|
||||
)
|
||||
else:
|
||||
state, message = self.__test(site_info)
|
||||
)
|
||||
# 统计
|
||||
seconds = (datetime.now() - start_time).seconds
|
||||
if state:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from typing import Optional
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from app.foundation.dom import DomUtils
|
||||
from app.foundation.url import split_netloc
|
||||
|
||||
|
||||
_SPECIAL_SITE_DOMAINS = (
|
||||
"u2.dmhy.org",
|
||||
"pt.ecust.pp.ua",
|
||||
@@ -39,6 +41,16 @@ def extract_domain(url: str) -> str:
|
||||
return ".".join(labels[-2:])
|
||||
|
||||
|
||||
def resolve_page_url(site_url: str, page_path: Optional[str]) -> str:
|
||||
"""将站点资源声明的页面路径解析为绝对地址。"""
|
||||
page_path = str(page_path or "").strip()
|
||||
if not page_path:
|
||||
return site_url
|
||||
if page_path.startswith(("http://", "https://")):
|
||||
return page_path
|
||||
return urljoin(f"{str(site_url).rstrip('/')}/", page_path.lstrip("/"))
|
||||
|
||||
|
||||
class SiteUtils:
|
||||
"""提供站点域名、Cookie 和访问参数处理能力。"""
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"app/chain/search/media.py:SearchMediaOwner": 522,
|
||||
"app/chain/search/provider.py:SearchProviderOwner": 662,
|
||||
"app/chain/search/subtitle.py:SearchSubtitleOwner": 528,
|
||||
"app/chain/site.py:SiteChain": 1015,
|
||||
"app/chain/site.py:SiteChain": 1003,
|
||||
"app/chain/subscribe/create.py:SubscribeCreateOwner": 646,
|
||||
"app/chain/subscribe/match.py:SubscribeMatchOwner": 571,
|
||||
"app/chain/subscribe/refresh.py:SubscribeRefreshOwner": 760,
|
||||
@@ -45,7 +45,7 @@
|
||||
"app/chain/interaction.py": 1571,
|
||||
"app/chain/message.py": 1984,
|
||||
"app/chain/scraping.py": 2065,
|
||||
"app/chain/site.py": 1199,
|
||||
"app/chain/site.py": 1187,
|
||||
"app/chain/transfer/queue.py": 1631,
|
||||
"app/chain/transfer/workflow.py": 1106,
|
||||
"app/chain/workflow.py": 1391
|
||||
|
||||
@@ -167,9 +167,6 @@
|
||||
"app/domain/scraper.py": {
|
||||
"I001": 1
|
||||
},
|
||||
"app/domain/site.py": {
|
||||
"I001": 1
|
||||
},
|
||||
"app/domain/title.py": {
|
||||
"I001": 1
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user