@dreamor/atlas-cli 0.7.7 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,8 +5,6 @@ import { isJsonMode, jsonOk, log } from '../util/output.js';
|
|
|
5
5
|
import { AtlasError } from '../util/errors.js';
|
|
6
6
|
const _require = createRequire(import.meta.url);
|
|
7
7
|
const BANMA_HOST = 'banma-yuntu.alibaba-inc.com';
|
|
8
|
-
// 白名单:只保存 getBanmaIdentity 真正需要的 cookies,避免整域 cookies 落盘
|
|
9
|
-
const WANT_COOKIES = new Set(['access_token', 'buc_username', 'buc_userinfo']);
|
|
10
8
|
/**
|
|
11
9
|
* 动态加载 playwright。顶层静态 import 会让单文件 bundle 在未安装 playwright 的
|
|
12
10
|
* 环境下无法启动(连 --version 都 require 失败),故改为运行时动态 import + try/catch
|
|
@@ -79,10 +77,10 @@ export async function login(_port) {
|
|
|
79
77
|
}
|
|
80
78
|
// 额外等待确保残留 cookie 写入完毕
|
|
81
79
|
await page.waitForTimeout(500);
|
|
82
|
-
// Extract cookies —
|
|
80
|
+
// Extract cookies — 保存 banma-yuntu 域下所有 cookies(API 网关需要完整会话链)
|
|
83
81
|
const cookies = await page.context().cookies();
|
|
84
82
|
const atlasCookies = cookies
|
|
85
|
-
.filter((c) =>
|
|
83
|
+
.filter((c) => c.domain?.includes('banma-yuntu') || c.domain?.includes('alibaba-inc'))
|
|
86
84
|
.map((c) => ({
|
|
87
85
|
name: c.name,
|
|
88
86
|
value: c.value,
|
|
@@ -117,6 +117,10 @@ export class HttpClient {
|
|
|
117
117
|
if (status === 401 || status === 403) {
|
|
118
118
|
throw new SessionExpiredError();
|
|
119
119
|
}
|
|
120
|
+
// 302 一般是重定向到登录页(session 失效 / 未授权)
|
|
121
|
+
if (status === 302) {
|
|
122
|
+
throw new SessionExpiredError('会话已失效或未授权,请重新登录');
|
|
123
|
+
}
|
|
120
124
|
// B2: 识别 429 限流
|
|
121
125
|
if (status === 429) {
|
|
122
126
|
throw new AtlasError('请求过于频繁(429 限流),请稍后重试', 'RATE_LIMITED');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ATLAS_VERSION = '0.7.
|
|
1
|
+
export const ATLAS_VERSION = '0.7.8';
|