@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.js CHANGED
@@ -1119,8 +1119,8 @@ const weitoutiaoPublish = async (task, params)=>{
1119
1119
  if ("mockApi" === params.actionType) return weitoutiaoPublish_mock_mockAction(task, params);
1120
1120
  return executeAction(weitoutiaoPublish_mock_mockAction, weitoutiaoPublish_rpa_rpaAction)(task, params);
1121
1121
  };
1122
- const GET_QRCODE_DEFAULT_ERROR = "群发二维码获取异常,请稍后重试发布。";
1123
1122
  const scanRetryMaxCount = 30;
1123
+ const GET_QRCODE_DEFAULT_ERROR = "群发二维码获取异常,请稍后重试发布。";
1124
1124
  const weixinPublish_mock_errnoMap = {
1125
1125
  200003: "微信公众号号登录状态失效,请重新绑定账号后重试。"
1126
1126
  };
@@ -1436,6 +1436,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
1436
1436
  task.logger.info("微信公众号发布完成。");
1437
1437
  return (0, share_namespaceObject.success)(appMsgId, "微信公众号发布完成。");
1438
1438
  };
1439
+ const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
1439
1440
  const weixinPublish_rpa_rpaAction = async (task, params)=>{
1440
1441
  const tmpCachePath = task.getTmpPath();
1441
1442
  const commonCookies = {
@@ -1567,6 +1568,49 @@ const weixinPublish_rpa_rpaAction = async (task, params)=>{
1567
1568
  state: "visible"
1568
1569
  });
1569
1570
  await page.locator(".new_mass_send_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
1571
+ await page.waitForSelector('.double_check_dialog .weui-desktop-dialog__wrp:not([style*="display: none"])', {
1572
+ state: "visible"
1573
+ });
1574
+ await page.locator(".double_check_dialog .weui-desktop-dialog .weui-desktop-dialog__ft button.weui-desktop-btn_primary").click();
1575
+ try {
1576
+ const startTime = Date.now();
1577
+ await new Promise(async (resolve, reject)=>{
1578
+ const handleResponse = async (response)=>{
1579
+ if (response.url().includes("/safe/safeuuid")) {
1580
+ const jsonResponse = await response.json();
1581
+ if (405 === jsonResponse.errcode) {
1582
+ resolve();
1583
+ page.off("response", handleResponse);
1584
+ } else if (Date.now() - startTime > waitQrcodeResultMaxTime) {
1585
+ reject();
1586
+ page.off("response", handleResponse);
1587
+ }
1588
+ }
1589
+ };
1590
+ page.on("response", handleResponse);
1591
+ await page.waitForSelector('.dialog .js_wxchecks.safe_check img.qrcode.js_qrcode', {
1592
+ state: "visible"
1593
+ });
1594
+ const qrcodeSrc = await page.locator('.dialog .js_wxchecks.safe_check img.qrcode.js_qrcode').first().getAttribute('src');
1595
+ const imgUrl = new URL(qrcodeSrc, page.url()).href;
1596
+ const response = await external_axios_default()({
1597
+ method: 'get',
1598
+ url: imgUrl,
1599
+ responseType: 'arraybuffer'
1600
+ });
1601
+ const qrcodeFilePath = external_node_path_default().join(tmpCachePath, "weixin_qrcode.jpg");
1602
+ external_node_fs_default().writeFileSync(qrcodeFilePath, response.data);
1603
+ params.safeQrcodeCallback?.(qrcodeFilePath);
1604
+ });
1605
+ } catch (error) {
1606
+ await page.close();
1607
+ return {
1608
+ code: 500,
1609
+ message: "群发二维码已过期,请重试发布。",
1610
+ data: ""
1611
+ };
1612
+ }
1613
+ await page.close();
1570
1614
  return (0, share_namespaceObject.success)(articleId);
1571
1615
  };
1572
1616
  const weixinPublish = async (task, params)=>{
@@ -2171,7 +2215,7 @@ const xiaohongshuPublish = async (task, params)=>{
2171
2215
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
2172
2216
  };
2173
2217
  var package_namespaceObject = {
2174
- i8: "1.1.20"
2218
+ i8: "1.1.21"
2175
2219
  };
2176
2220
  class Action {
2177
2221
  constructor(task){