@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.mjs CHANGED
@@ -5434,7 +5434,7 @@ function __webpack_require__(moduleId) {
5434
5434
  return module;
5435
5435
  };
5436
5436
  })();
5437
- var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.5"}');
5437
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.7"}');
5438
5438
  var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
5439
5439
  async function ProxyAgent(task, ip, adr, accountId, refresh) {
5440
5440
  const http = new Http({
@@ -11820,16 +11820,35 @@ const WxSessionCheck = async (_task, params)=>{
11820
11820
  }, "微信账号有效性检测完成!");
11821
11821
  };
11822
11822
  const XhsSessionCheck = async (_task, params)=>{
11823
+ const logger = _task.logger;
11824
+ const startedAt = Date.now();
11823
11825
  const check = {
11824
11826
  isValidSession: false,
11825
11827
  isValidWebSession: false
11826
11828
  };
11829
+ const cookieNames = params.cookies.map((it)=>it.name);
11830
+ logger?.info("[XhsSessionCheck] 开始执行小红书账号有效性检测", {
11831
+ accountId: params.accountId,
11832
+ proxyLoc: params.proxyLoc,
11833
+ localIP: params.localIP,
11834
+ willUseProxyAgent: !!params.localIP,
11835
+ cookieCount: params.cookies.length,
11836
+ cookieNames,
11837
+ hasA1: cookieNames.includes("a1"),
11838
+ hasWebSession: cookieNames.includes("web_session")
11839
+ });
11827
11840
  const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
11828
- if (!a1Cookie) return {
11829
- code: 414,
11830
- message: "账号数据异常,请重新绑定账号后重试。",
11831
- data: check
11832
- };
11841
+ if (!a1Cookie) {
11842
+ logger?.warn("[XhsSessionCheck] 缺失关键 cookie a1,提前返回", {
11843
+ accountId: params.accountId,
11844
+ cookieNames
11845
+ });
11846
+ return {
11847
+ code: 414,
11848
+ message: "账号数据异常,请重新绑定账号后重试。",
11849
+ data: check
11850
+ };
11851
+ }
11833
11852
  const headers = {
11834
11853
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
11835
11854
  referer: "https://creator.xiaohongshu.com/new/home?source=official"
@@ -11857,6 +11876,7 @@ const XhsSessionCheck = async (_task, params)=>{
11857
11876
  return acc;
11858
11877
  }, {});
11859
11878
  const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
11879
+ const baseInfoStart = Date.now();
11860
11880
  const _baseInfo = http.api({
11861
11881
  method: "get",
11862
11882
  baseURL: "https://creator.xiaohongshu.com",
@@ -11866,7 +11886,28 @@ const XhsSessionCheck = async (_task, params)=>{
11866
11886
  retries: 3,
11867
11887
  retryDelay: 20,
11868
11888
  timeout: 3000
11869
- }).catch((e)=>e.data);
11889
+ }).then((res)=>{
11890
+ logger?.info("[XhsSessionCheck] creator base 接口请求成功", {
11891
+ accountId: params.accountId,
11892
+ duration: Date.now() - baseInfoStart,
11893
+ code: res?.code,
11894
+ msg: res?.msg,
11895
+ proxyInfo: http.proxyInfo
11896
+ });
11897
+ return res;
11898
+ }).catch((e)=>{
11899
+ logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
11900
+ accountId: params.accountId,
11901
+ duration: Date.now() - baseInfoStart,
11902
+ code: e?.code,
11903
+ message: e?.message,
11904
+ data: e?.data,
11905
+ extra: e?.extra,
11906
+ proxyInfo: http.proxyInfo
11907
+ });
11908
+ return e.data;
11909
+ });
11910
+ const webSessionStart = Date.now();
11870
11911
  const _web_session = http.api({
11871
11912
  method: "get",
11872
11913
  url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
@@ -11874,6 +11915,26 @@ const XhsSessionCheck = async (_task, params)=>{
11874
11915
  retries: 3,
11875
11916
  retryDelay: 20,
11876
11917
  timeout: 3000
11918
+ }).then((res)=>{
11919
+ logger?.info("[XhsSessionCheck] edith unread_count 接口请求成功", {
11920
+ accountId: params.accountId,
11921
+ duration: Date.now() - webSessionStart,
11922
+ code: res?.code,
11923
+ msg: res?.msg,
11924
+ proxyInfo: http.proxyInfo
11925
+ });
11926
+ return res;
11927
+ }).catch((e)=>{
11928
+ logger?.warn("[XhsSessionCheck] edith unread_count 接口请求失败", {
11929
+ accountId: params.accountId,
11930
+ duration: Date.now() - webSessionStart,
11931
+ code: e?.code,
11932
+ message: e?.message,
11933
+ data: e?.data,
11934
+ extra: e?.extra,
11935
+ proxyInfo: http.proxyInfo
11936
+ });
11937
+ throw e;
11877
11938
  });
11878
11939
  const [baseInfo, web_session] = await Promise.all([
11879
11940
  _baseInfo,
@@ -11881,8 +11942,18 @@ const XhsSessionCheck = async (_task, params)=>{
11881
11942
  ]);
11882
11943
  if (baseInfo?.code === 0) check.isValidSession = true;
11883
11944
  if (0 === web_session.code) check.isValidWebSession = true;
11884
- baseInfo?.code, web_session.code;
11945
+ const _isSuccess = baseInfo?.code === web_session.code;
11885
11946
  const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
11947
+ logger?.info("[XhsSessionCheck] 检测完成", {
11948
+ accountId: params.accountId,
11949
+ totalDuration: Date.now() - startedAt,
11950
+ baseInfoCode: baseInfo?.code,
11951
+ webSessionCode: web_session?.code,
11952
+ isValidSession: check.isValidSession,
11953
+ isValidWebSession: check.isValidWebSession,
11954
+ codeAligned: _isSuccess,
11955
+ proxyInfo: http.proxyInfo
11956
+ });
11886
11957
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(check, message);
11887
11958
  };
11888
11959
  const BjhSessionCheck = async (_task, params)=>{