* 为指定账户初始化CLI信息(公共方法) * @param {Object} account - 账户对象 * @returns {Promise } 初始化是否成功
(account)
| 972 | } |
| 973 | |
| 974 | // 旧代理 URL 不再被该账户引用,主动失效缓存 |
| 975 | // 注意:其他账户可能仍在使用同一 URL,但 invalidate 仅按 URL 操作; |
| 976 | // 多账户共享代理的场景下后续请求会重新创建 agent,安全 |
| 977 | if (oldProxy && oldProxy !== newProxy) { |
| 978 | const { invalidateProxyAgent } = require('./proxy-helper') |
| 979 | invalidateProxyAgent(oldProxy) |
| 980 | } |
| 981 | |
| 982 | logger.success(`账户 ${email} 代理更新成功 (${oldProxy || '无'} → ${newProxy || '无'})`, 'ACCOUNT') |
| 983 | return true |
| 984 | } catch (error) { |
| 985 | logger.error(`更新账户 ${email} 代理失败`, 'ACCOUNT', '', error) |
| 986 | return false |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | /** |
nothing calls this directly
no test coverage detected