@iflyrpa/actions 3.0.4 → 3.0.5-beta.2

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
@@ -8736,9 +8736,7 @@ var __webpack_exports__ = {};
8736
8736
  var package_namespaceObject = {
8737
8737
  i8: "0.1.0"
8738
8738
  };
8739
- var package_namespaceObject_0 = {
8740
- i8: "3.0.3"
8741
- };
8739
+ var package_namespaceObject_0 = JSON.parse('{"i8":"3.0.5-beta.2"}');
8742
8740
  const external_node_fs_namespaceObject = require("node:fs");
8743
8741
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
8744
8742
  const external_node_http_namespaceObject = require("node:http");
@@ -23355,6 +23353,13 @@ var __webpack_exports__ = {};
23355
23353
  }
23356
23354
  };
23357
23355
  if (foundError) Object.assign(errorResponse, foundError);
23356
+ if (error.response?.status === 403) {
23357
+ this.logger?.warn(`[403 详细信息] URL: ${error.config?.url}`);
23358
+ this.logger?.warn(`[403 响应头] ${JSON.stringify(error.response?.headers || {})}`);
23359
+ this.logger?.warn(`[403 响应体] ${JSON.stringify(error.response?.data || null)}`);
23360
+ const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
23361
+ if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
23362
+ }
23358
23363
  if (error.response?.data) {
23359
23364
  if ("object" == typeof error.response.data) {
23360
23365
  const serverError = error.response.data;
@@ -34773,54 +34778,55 @@ var __webpack_exports__ = {};
34773
34778
  })}`);
34774
34779
  task.logger.info(`publishData: ${JSON.stringify(publishData)}`);
34775
34780
  task.logger.info(`url: https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`);
34776
- let publishResult;
34777
- try {
34778
- publishResult = await proxyHttp.api({
34779
- method: "post",
34780
- url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
34781
- data: publishData,
34782
- defaultErrorMsg: "发布异常,请稍后重试。",
34783
- headers: {
34784
- ...headers,
34785
- Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
34786
- "Content-Type": "application/json",
34787
- Accept: "application/json, text/plain, */*",
34788
- "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
34789
- "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
34790
- "bd-ticket-guard-version": "2",
34791
- "bd-ticket-guard-web-sign-type": "1",
34792
- "bd-ticket-guard-web-version": "2",
34793
- "x-secsdk-csrf-token": csrfToken,
34794
- "x-tt-session-dtrait": sessionDtrait || ""
34795
- }
34796
- }, {
34797
- timeout: 60000,
34798
- retries: 3,
34799
- retryDelay: 2000
34800
- });
34801
- } catch (error) {
34802
- const upstreamMessage = error?.message || String(error);
34803
- const upstreamCode = error?.code;
34804
- task.logger.error(`TaskId:${task.taskId},create_v2 请求异常,上游错误已屏蔽。上游 code=${upstreamCode},message=${upstreamMessage}`, {
34805
- error,
34806
- upstreamData: error?.data,
34807
- extra: error?.extra
34808
- });
34809
- const message = "发布失败,请重试";
34810
- await updateTaskState?.({
34781
+ const publishResult = await proxyHttp.api({
34782
+ method: "post",
34783
+ url: `https://creator.douyin.com/web/api/media/aweme/create_v2/?${publishQueryParams}`,
34784
+ data: publishData,
34785
+ defaultErrorMsg: "发布异常,请稍后重试。",
34786
+ headers: {
34787
+ ...headers,
34788
+ Referer: "https://creator.douyin.com/creator-micro/content/post/image?default-tab=3&enter_from=publish_page&media_type=image&type=new",
34789
+ "Content-Type": "application/json",
34790
+ Accept: "application/json, text/plain, */*",
34791
+ "bd-ticket-guard-client-data": bdTicketGuardClientData["headers_bd_ticket_guard_client_data"],
34792
+ "bd-ticket-guard-ree-public-key": bdTicketGuardClientData["headers_bd_ticket_guard_ree_public_key"],
34793
+ "bd-ticket-guard-version": "2",
34794
+ "bd-ticket-guard-web-sign-type": "1",
34795
+ "bd-ticket-guard-web-version": "2",
34796
+ "x-secsdk-csrf-token": csrfToken,
34797
+ "x-tt-session-dtrait": sessionDtrait || ""
34798
+ }
34799
+ }, {
34800
+ timeout: 60000,
34801
+ retries: 3,
34802
+ retryDelay: 2000
34803
+ });
34804
+ task.logger.info("========== api调用完成 ==========");
34805
+ task.logger.info(`decision值: ${JSON.stringify(decision)}, needsVerification(decision): ${needsVerification(decision)}`);
34806
+ if (needsVerification(decision)) {
34807
+ const details = [
34808
+ publishResult.status_msg,
34809
+ decision?.verify_title,
34810
+ decision?.verify_desc
34811
+ ].filter(Boolean).join(" ");
34812
+ const message = `图文发布失败,原因:${details}${task.debug ? ` ${http.proxyInfo}` : ""}`;
34813
+ task.logger.warn(`TaskId:${task.taskId},检测到需要验证,准备返回验证信息`);
34814
+ const mockData = {
34811
34815
  state: types_TaskState.FAILED,
34812
34816
  error: message,
34813
34817
  result: {
34814
34818
  data: decision,
34815
34819
  uploadedImgList: JSON.stringify(publishData.item.common.images)
34816
34820
  }
34817
- });
34821
+ };
34822
+ await updateTaskState?.(mockData);
34818
34823
  return {
34819
- code: 414,
34820
- data: "",
34821
- message
34824
+ code: 0,
34825
+ data: mockData,
34826
+ message: "操作成功"
34822
34827
  };
34823
34828
  }
34829
+ task.logger.info("不需要验证,继续正常流程");
34824
34830
  reportLogger({
34825
34831
  token: params.huiwenToken || "",
34826
34832
  enverionment: task.enverionment || "development",
@@ -36339,26 +36345,26 @@ var __webpack_exports__ = {};
36339
36345
  const http = new Http({
36340
36346
  headers: {
36341
36347
  cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
36342
- referer: "https://mp.toutiao.com/profile_v4/graphic/publish"
36348
+ referer: "https://mp.toutiao.com/profile_v4/graphic/publish",
36349
+ "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"
36350
+ }
36351
+ });
36352
+ const totalData = await http.api({
36353
+ method: "get",
36354
+ url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
36355
+ params: {
36356
+ app_id: 1231
36357
+ }
36358
+ });
36359
+ await new Promise((r)=>setTimeout(r, 1000));
36360
+ const contentDataYesterday = await http.api({
36361
+ method: "get",
36362
+ url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
36363
+ params: {
36364
+ type: 0,
36365
+ app_id: 1231
36343
36366
  }
36344
36367
  });
36345
- const [totalData, contentDataYesterday] = await Promise.all([
36346
- http.api({
36347
- method: "get",
36348
- url: "https://mp.toutiao.com/mp/fe_api/home/merge_v2",
36349
- params: {
36350
- app_id: 1231
36351
- }
36352
- }),
36353
- http.api({
36354
- method: "get",
36355
- url: "https://mp.toutiao.com/mp/agw/statistic/v2/content_stat",
36356
- params: {
36357
- type: 0,
36358
- app_id: 1231
36359
- }
36360
- })
36361
- ]);
36362
36368
  const isSuccess = !!(totalData?.data?.statistic && contentDataYesterday?.author_stat);
36363
36369
  if (!isSuccess || !totalData?.data || !contentDataYesterday?.author_stat) return types_errorResponse(totalData?.message || contentDataYesterday?.message || "头条号数据获取失败,请检查Cookie是否有效", 414);
36364
36370
  const ttData = {
@@ -41781,8 +41787,8 @@ var __webpack_exports__ = {};
41781
41787
  headers
41782
41788
  });
41783
41789
  const proxyHttp = new Http(...args);
41784
- proxyHttp.addResponseInterceptor((response)=>{
41785
- const responseData = response.data;
41790
+ const baseRespFinder = (response)=>{
41791
+ const responseData = response?.data;
41786
41792
  const msgType = "draft" === params.saveType ? "同步" : "发布";
41787
41793
  if (response && responseData?.base_resp && 0 !== responseData.base_resp.ret && !ignoreErrno.includes(responseData.base_resp.ret)) {
41788
41794
  const errmsg = weixinPublish_mock_errnoMap[responseData.base_resp.ret] || response.config.defaultErrorMsg || responseData.base_resp.err_msg || `文章${msgType}异常,请稍后重试。`;
@@ -41792,7 +41798,9 @@ var __webpack_exports__ = {};
41792
41798
  data: responseData
41793
41799
  };
41794
41800
  }
41795
- });
41801
+ };
41802
+ http.addResponseInterceptor(baseRespFinder);
41803
+ proxyHttp.addResponseInterceptor(baseRespFinder);
41796
41804
  await http.api({
41797
41805
  method: "get",
41798
41806
  url: "https://mp.weixin.qq.com/cgi-bin/appmsgpublish",