增加代理展示
This commit is contained in:
@@ -93,6 +93,7 @@ class AccountCheckBatch:
|
||||
concurrency: int
|
||||
max_login_retries: int
|
||||
max_total_time: float
|
||||
use_proxy: bool
|
||||
items: list[AccountCheckItemState]
|
||||
status: str = "pending"
|
||||
message: str = "等待开始"
|
||||
@@ -146,7 +147,12 @@ class AccountCheckRunner:
|
||||
|
||||
def _create_proxy_fetcher(self) -> ProxyFetcher | None:
|
||||
"""按全局代理配置创建 API 代理获取器。"""
|
||||
if not self.proxy_config or not self.proxy_config.enabled or not self.proxy_config.api_url:
|
||||
if (
|
||||
not self.batch.use_proxy
|
||||
or not self.proxy_config
|
||||
or not self.proxy_config.enabled
|
||||
or not self.proxy_config.api_url
|
||||
):
|
||||
return None
|
||||
|
||||
wl_platform = "xiequ"
|
||||
@@ -169,9 +175,12 @@ class AccountCheckRunner:
|
||||
|
||||
def _resolve_static_proxy(self) -> tuple[dict[str, str] | None, str]:
|
||||
"""解析静态代理;API 代理由 DouyuLogin 内部通过 proxy_fetcher 获取。"""
|
||||
if not self.proxy_config or not self.proxy_config.enabled:
|
||||
if not self.batch.use_proxy:
|
||||
return None, ""
|
||||
|
||||
if not self.proxy_config or not self.proxy_config.enabled:
|
||||
return None, "代理不可用: 未启用代理配置"
|
||||
|
||||
if self.proxy_config.http or self.proxy_config.https:
|
||||
proxy_url = self.proxy_config.http or self.proxy_config.https
|
||||
return {"http": proxy_url, "https": proxy_url}, ""
|
||||
@@ -261,6 +270,7 @@ class AccountCheckRunner:
|
||||
"concurrency": self.batch.concurrency,
|
||||
"max_login_retries": self.batch.max_login_retries,
|
||||
"max_total_time": self.batch.max_total_time,
|
||||
"use_proxy": self.batch.use_proxy,
|
||||
"total": len(self.batch.items),
|
||||
"finished_count": finished_count,
|
||||
"running_count": running_count,
|
||||
@@ -338,6 +348,7 @@ class AccountCheckRegistry:
|
||||
concurrency: int,
|
||||
max_login_retries: int,
|
||||
max_total_time: float,
|
||||
use_proxy: bool = False,
|
||||
proxy_config: Optional[ProxyConfigModel] = None,
|
||||
) -> AccountCheckRunner:
|
||||
batch_id = uuid.uuid4().hex[:12]
|
||||
@@ -348,6 +359,7 @@ class AccountCheckRegistry:
|
||||
concurrency=max(1, min(int(concurrency or 1), 10)),
|
||||
max_login_retries=normalized_retries,
|
||||
max_total_time=max(0.0, float(max_total_time or 0)),
|
||||
use_proxy=bool(use_proxy),
|
||||
items=[
|
||||
AccountCheckItemState(
|
||||
line=account.line,
|
||||
|
||||
Reference in New Issue
Block a user