@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/index.js CHANGED
@@ -5489,7 +5489,7 @@ var __webpack_exports__ = {};
5489
5489
  });
5490
5490
  const package_json_namespaceObject = require("@iflyrpa/share/package.json");
5491
5491
  var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
5492
- var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.5"}');
5492
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.7"}');
5493
5493
  const share_namespaceObject = require("@iflyrpa/share");
5494
5494
  const external_node_fs_namespaceObject = require("node:fs");
5495
5495
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -11896,16 +11896,35 @@ var __webpack_exports__ = {};
11896
11896
  }, "微信账号有效性检测完成!");
11897
11897
  };
11898
11898
  const XhsSessionCheck = async (_task, params)=>{
11899
+ const logger = _task.logger;
11900
+ const startedAt = Date.now();
11899
11901
  const check = {
11900
11902
  isValidSession: false,
11901
11903
  isValidWebSession: false
11902
11904
  };
11905
+ const cookieNames = params.cookies.map((it)=>it.name);
11906
+ logger?.info("[XhsSessionCheck] 开始执行小红书账号有效性检测", {
11907
+ accountId: params.accountId,
11908
+ proxyLoc: params.proxyLoc,
11909
+ localIP: params.localIP,
11910
+ willUseProxyAgent: !!params.localIP,
11911
+ cookieCount: params.cookies.length,
11912
+ cookieNames,
11913
+ hasA1: cookieNames.includes("a1"),
11914
+ hasWebSession: cookieNames.includes("web_session")
11915
+ });
11903
11916
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
11904
- if (!a1Cookie) return {
11905
- code: 414,
11906
- message: "账号数据异常,请重新绑定账号后重试。",
11907
- data: check
11908
- };
11917
+ if (!a1Cookie) {
11918
+ logger?.warn("[XhsSessionCheck] 缺失关键 cookie a1,提前返回", {
11919
+ accountId: params.accountId,
11920
+ cookieNames
11921
+ });
11922
+ return {
11923
+ code: 414,
11924
+ message: "账号数据异常,请重新绑定账号后重试。",
11925
+ data: check
11926
+ };
11927
+ }
11909
11928
  const headers = {
11910
11929
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11911
11930
  referer: "https://creator.xiaohongshu.com/new/home?source=official"
@@ -11933,6 +11952,7 @@ var __webpack_exports__ = {};
11933
11952
  return acc;
11934
11953
  }, {});
11935
11954
  const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
11955
+ const baseInfoStart = Date.now();
11936
11956
  const _baseInfo = http.api({
11937
11957
  method: "get",
11938
11958
  baseURL: "https://creator.xiaohongshu.com",
@@ -11942,7 +11962,28 @@ var __webpack_exports__ = {};
11942
11962
  retries: 3,
11943
11963
  retryDelay: 20,
11944
11964
  timeout: 3000
11945
- }).catch((e)=>e.data);
11965
+ }).then((res)=>{
11966
+ logger?.info("[XhsSessionCheck] creator base 接口请求成功", {
11967
+ accountId: params.accountId,
11968
+ duration: Date.now() - baseInfoStart,
11969
+ code: res?.code,
11970
+ msg: res?.msg,
11971
+ proxyInfo: http.proxyInfo
11972
+ });
11973
+ return res;
11974
+ }).catch((e)=>{
11975
+ logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
11976
+ accountId: params.accountId,
11977
+ duration: Date.now() - baseInfoStart,
11978
+ code: e?.code,
11979
+ message: e?.message,
11980
+ data: e?.data,
11981
+ extra: e?.extra,
11982
+ proxyInfo: http.proxyInfo
11983
+ });
11984
+ return e.data;
11985
+ });
11986
+ const webSessionStart = Date.now();
11946
11987
  const _web_session = http.api({
11947
11988
  method: "get",
11948
11989
  url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
@@ -11950,6 +11991,26 @@ var __webpack_exports__ = {};
11950
11991
  retries: 3,
11951
11992
  retryDelay: 20,
11952
11993
  timeout: 3000
11994
+ }).then((res)=>{
11995
+ logger?.info("[XhsSessionCheck] edith unread_count 接口请求成功", {
11996
+ accountId: params.accountId,
11997
+ duration: Date.now() - webSessionStart,
11998
+ code: res?.code,
11999
+ msg: res?.msg,
12000
+ proxyInfo: http.proxyInfo
12001
+ });
12002
+ return res;
12003
+ }).catch((e)=>{
12004
+ logger?.warn("[XhsSessionCheck] edith unread_count 接口请求失败", {
12005
+ accountId: params.accountId,
12006
+ duration: Date.now() - webSessionStart,
12007
+ code: e?.code,
12008
+ message: e?.message,
12009
+ data: e?.data,
12010
+ extra: e?.extra,
12011
+ proxyInfo: http.proxyInfo
12012
+ });
12013
+ throw e;
11953
12014
  });
11954
12015
  const [baseInfo, web_session] = await Promise.all([
11955
12016
  _baseInfo,
@@ -11957,8 +12018,18 @@ var __webpack_exports__ = {};
11957
12018
  ]);
11958
12019
  if (baseInfo?.code === 0) check.isValidSession = true;
11959
12020
  if (0 === web_session.code) check.isValidWebSession = true;
11960
- baseInfo?.code, web_session.code;
12021
+ const _isSuccess = baseInfo?.code === web_session.code;
11961
12022
  const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
12023
+ logger?.info("[XhsSessionCheck] 检测完成", {
12024
+ accountId: params.accountId,
12025
+ totalDuration: Date.now() - startedAt,
12026
+ baseInfoCode: baseInfo?.code,
12027
+ webSessionCode: web_session?.code,
12028
+ isValidSession: check.isValidSession,
12029
+ isValidWebSession: check.isValidWebSession,
12030
+ codeAligned: _isSuccess,
12031
+ proxyInfo: http.proxyInfo
12032
+ });
11962
12033
  return (0, share_namespaceObject.success)(check, message);
11963
12034
  };
11964
12035
  const BjhSessionCheck = async (_task, params)=>{