@iflyrpa/actions 1.1.21 → 1.1.22

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
@@ -1071,8 +1071,8 @@ const weitoutiaoPublish = async (task, params)=>{
1071
1071
  if ("mockApi" === params.actionType) return weitoutiaoPublish_mock_mockAction(task, params);
1072
1072
  return executeAction(weitoutiaoPublish_mock_mockAction, weitoutiaoPublish_rpa_rpaAction)(task, params);
1073
1073
  };
1074
- const GET_QRCODE_DEFAULT_ERROR = "群发二维码获取异常,请稍后重试发布。";
1075
1074
  const scanRetryMaxCount = 30;
1075
+ const GET_QRCODE_DEFAULT_ERROR = "群发二维码获取异常,请稍后重试发布。";
1076
1076
  const weixinPublish_mock_errnoMap = {
1077
1077
  200003: "微信公众号号登录状态失效,请重新绑定账号后重试。"
1078
1078
  };
@@ -1388,6 +1388,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
1388
1388
  task.logger.info("微信公众号发布完成。");
1389
1389
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, "微信公众号发布完成。");
1390
1390
  };
1391
+ const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
1391
1392
  const weixinPublish_rpa_rpaAction = async (task, params)=>{
1392
1393
  const tmpCachePath = task.getTmpPath();
1393
1394
  const commonCookies = {
@@ -1519,6 +1520,49 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
1519
1520
  state: "visible"
1520
1521
  });
1521
1522
  await page.locator(".new_mass_send_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
1523
+ await page.waitForSelector('.double_check_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
1524
+ state: "visible"
1525
+ });
1526
+ await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
1527
+ try {
1528
+ const startTime = Date.now();
1529
+ await new Promise(async (resolve, reject)=>{
1530
+ const handleResponse = async (response)=>{
1531
+ if (response.url().includes("/safe/safeuuid")) {
1532
+ const jsonResponse = await response.json();
1533
+ if (405 === jsonResponse.errcode) {
1534
+ resolve();
1535
+ page.off("response", handleResponse);
1536
+ } else if (Date.now() - startTime > waitQrcodeResultMaxTime) {
1537
+ reject();
1538
+ page.off("response", handleResponse);
1539
+ }
1540
+ }
1541
+ };
1542
+ page.on("response", handleResponse);
1543
+ await page.waitForSelector('.dialog .js_wxchecks.safe_check img.qrcode.js_qrcode', {
1544
+ state: "visible"
1545
+ });
1546
+ const qrcodeSrc = await page.locator('.dialog .js_wxchecks.safe_check img.qrcode.js_qrcode').first().getAttribute('src');
1547
+ const imgUrl = new URL(qrcodeSrc, page.url()).href;
1548
+ const response = await (0, __WEBPACK_EXTERNAL_MODULE_axios__["default"])({
1549
+ method: 'get',
1550
+ url: imgUrl,
1551
+ responseType: 'arraybuffer'
1552
+ });
1553
+ const qrcodeFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(tmpCachePath, "weixin_qrcode.jpg");
1554
+ __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__["default"].writeFileSync(qrcodeFilePath, response.data);
1555
+ params.safeQrcodeCallback?.(qrcodeFilePath);
1556
+ });
1557
+ } catch (error) {
1558
+ await page.close();
1559
+ return {
1560
+ code: 500,
1561
+ message: "群发二维码已过期,请重试发布。",
1562
+ data: ""
1563
+ };
1564
+ }
1565
+ await page.close();
1522
1566
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(articleId);
1523
1567
  };
1524
1568
  const weixinPublish = async (task, params)=>{
@@ -2120,7 +2164,7 @@ const xiaohongshuPublish = async (task, params)=>{
2120
2164
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
2121
2165
  };
2122
2166
  var package_namespaceObject = {
2123
- i8: "1.1.20"
2167
+ i8: "1.1.21"
2124
2168
  };
2125
2169
  class Action {
2126
2170
  constructor(task){