mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: 修复 NewApiBalanceAction 中 Cookie 检测方式
将 Cookie 检测从 httpx client headers 检查改为 service 层注入的 _has_cookie 配置标志,解决 Cookie 在实际请求中存在但检测失败的问题
This commit is contained in:
@@ -125,9 +125,8 @@ class NewApiBalanceAction(BalanceAction):
|
|||||||
site = client.base_url.host or str(client.base_url)
|
site = client.base_url.host or str(client.base_url)
|
||||||
checkin_endpoint = self.config.get("checkin_endpoint", "/api/user/checkin")
|
checkin_endpoint = self.config.get("checkin_endpoint", "/api/user/checkin")
|
||||||
|
|
||||||
# 检查 client 是否配置了 Cookie(通过检查默认 headers)
|
# 检查是否配置了 Cookie(通过 service 层注入的 _has_cookie 标志)
|
||||||
# httpx.AsyncClient 的 headers 是 httpx.Headers 类型
|
has_cookie = self.config.get("_has_cookie", False)
|
||||||
has_cookie = "cookie" in {k.lower() for k in client.headers.keys()}
|
|
||||||
if not has_cookie:
|
if not has_cookie:
|
||||||
logger.debug(f"[{site}] 未配置 Cookie,跳过签到")
|
logger.debug(f"[{site}] 未配置 Cookie,跳过签到")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -320,6 +320,11 @@ class ProviderOpsService:
|
|||||||
saved_action_config = config.actions.get(action_type.value, {}).get("config", {})
|
saved_action_config = config.actions.get(action_type.value, {}).get("config", {})
|
||||||
merged_config = {**saved_action_config, **(action_config or {})}
|
merged_config = {**saved_action_config, **(action_config or {})}
|
||||||
|
|
||||||
|
# 注入 credentials 元信息(如是否配置了 Cookie),供 Action 使用
|
||||||
|
decrypted_credentials = self._decrypt_credentials(config.connector_credentials)
|
||||||
|
if decrypted_credentials.get("cookie"):
|
||||||
|
merged_config["_has_cookie"] = True
|
||||||
|
|
||||||
# 创建操作实例
|
# 创建操作实例
|
||||||
action = architecture.get_action(action_type, merged_config)
|
action = architecture.get_action(action_type, merged_config)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user