@iflyrpa/actions 4.0.0-beta.6 → 4.0.0-beta.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.
package/dist/bundle.js CHANGED
@@ -8733,10 +8733,8 @@ var __webpack_exports__ = {};
8733
8733
  navigator: ()=>_navigator,
8734
8734
  origin: ()=>utils_origin
8735
8735
  });
8736
- var package_namespaceObject = {
8737
- i8: "0.1.1"
8738
- };
8739
- var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.0-beta.5"}');
8736
+ var package_namespaceObject = JSON.parse('{"i8":"1.0.0-beta.0"}');
8737
+ var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.0-beta.7"}');
8740
8738
  const external_node_fs_namespaceObject = require("node:fs");
8741
8739
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
8742
8740
  const external_node_http_namespaceObject = require("node:http");
@@ -30638,16 +30636,35 @@ var __webpack_exports__ = {};
30638
30636
  }, "微信账号有效性检测完成!");
30639
30637
  };
30640
30638
  const XhsSessionCheck = async (_task, params)=>{
30639
+ const logger = _task.logger;
30640
+ const startedAt = Date.now();
30641
30641
  const check = {
30642
30642
  isValidSession: false,
30643
30643
  isValidWebSession: false
30644
30644
  };
30645
+ const cookieNames = params.cookies.map((it)=>it.name);
30646
+ logger?.info("[XhsSessionCheck] 开始执行小红书账号有效性检测", {
30647
+ accountId: params.accountId,
30648
+ proxyLoc: params.proxyLoc,
30649
+ localIP: params.localIP,
30650
+ willUseProxyAgent: !!params.localIP,
30651
+ cookieCount: params.cookies.length,
30652
+ cookieNames,
30653
+ hasA1: cookieNames.includes("a1"),
30654
+ hasWebSession: cookieNames.includes("web_session")
30655
+ });
30645
30656
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
30646
- if (!a1Cookie) return {
30647
- code: 414,
30648
- message: "账号数据异常,请重新绑定账号后重试。",
30649
- data: check
30650
- };
30657
+ if (!a1Cookie) {
30658
+ logger?.warn("[XhsSessionCheck] 缺失关键 cookie a1,提前返回", {
30659
+ accountId: params.accountId,
30660
+ cookieNames
30661
+ });
30662
+ return {
30663
+ code: 414,
30664
+ message: "账号数据异常,请重新绑定账号后重试。",
30665
+ data: check
30666
+ };
30667
+ }
30651
30668
  const headers = {
30652
30669
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
30653
30670
  referer: "https://creator.xiaohongshu.com/new/home?source=official"
@@ -30675,6 +30692,7 @@ var __webpack_exports__ = {};
30675
30692
  return acc;
30676
30693
  }, {});
30677
30694
  const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
30695
+ const baseInfoStart = Date.now();
30678
30696
  const _baseInfo = http.api({
30679
30697
  method: "get",
30680
30698
  baseURL: "https://creator.xiaohongshu.com",
@@ -30684,7 +30702,28 @@ var __webpack_exports__ = {};
30684
30702
  retries: 3,
30685
30703
  retryDelay: 20,
30686
30704
  timeout: 3000
30687
- }).catch((e)=>e.data);
30705
+ }).then((res)=>{
30706
+ logger?.info("[XhsSessionCheck] creator base 接口请求成功", {
30707
+ accountId: params.accountId,
30708
+ duration: Date.now() - baseInfoStart,
30709
+ code: res?.code,
30710
+ msg: res?.msg,
30711
+ proxyInfo: http.proxyInfo
30712
+ });
30713
+ return res;
30714
+ }).catch((e)=>{
30715
+ logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
30716
+ accountId: params.accountId,
30717
+ duration: Date.now() - baseInfoStart,
30718
+ code: e?.code,
30719
+ message: e?.message,
30720
+ data: e?.data,
30721
+ extra: e?.extra,
30722
+ proxyInfo: http.proxyInfo
30723
+ });
30724
+ return e.data;
30725
+ });
30726
+ const webSessionStart = Date.now();
30688
30727
  const _web_session = http.api({
30689
30728
  method: "get",
30690
30729
  url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
@@ -30692,6 +30731,26 @@ var __webpack_exports__ = {};
30692
30731
  retries: 3,
30693
30732
  retryDelay: 20,
30694
30733
  timeout: 3000
30734
+ }).then((res)=>{
30735
+ logger?.info("[XhsSessionCheck] edith unread_count 接口请求成功", {
30736
+ accountId: params.accountId,
30737
+ duration: Date.now() - webSessionStart,
30738
+ code: res?.code,
30739
+ msg: res?.msg,
30740
+ proxyInfo: http.proxyInfo
30741
+ });
30742
+ return res;
30743
+ }).catch((e)=>{
30744
+ logger?.warn("[XhsSessionCheck] edith unread_count 接口请求失败", {
30745
+ accountId: params.accountId,
30746
+ duration: Date.now() - webSessionStart,
30747
+ code: e?.code,
30748
+ message: e?.message,
30749
+ data: e?.data,
30750
+ extra: e?.extra,
30751
+ proxyInfo: http.proxyInfo
30752
+ });
30753
+ throw e;
30695
30754
  });
30696
30755
  const [baseInfo, web_session] = await Promise.all([
30697
30756
  _baseInfo,
@@ -30699,8 +30758,18 @@ var __webpack_exports__ = {};
30699
30758
  ]);
30700
30759
  if (baseInfo?.code === 0) check.isValidSession = true;
30701
30760
  if (0 === web_session.code) check.isValidWebSession = true;
30702
- baseInfo?.code, web_session.code;
30761
+ const _isSuccess = baseInfo?.code === web_session.code;
30703
30762
  const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
30763
+ logger?.info("[XhsSessionCheck] 检测完成", {
30764
+ accountId: params.accountId,
30765
+ totalDuration: Date.now() - startedAt,
30766
+ baseInfoCode: baseInfo?.code,
30767
+ webSessionCode: web_session?.code,
30768
+ isValidSession: check.isValidSession,
30769
+ isValidWebSession: check.isValidWebSession,
30770
+ codeAligned: _isSuccess,
30771
+ proxyInfo: http.proxyInfo
30772
+ });
30704
30773
  return success(check, message);
30705
30774
  };
30706
30775
  const BjhSessionCheck = async (_task, params)=>{