@iflyrpa/actions 1.2.24-beta.0 → 1.2.24-beta.10

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
@@ -2870,14 +2870,19 @@ const ProxyData = {
2870
2870
  md5akey: "6ec8d333e85044b7",
2871
2871
  akey: "91709114"
2872
2872
  };
2873
- const ProxyAgent = async (adr)=>{
2873
+ const ProxyAgent = async (adr, huiwenToken)=>{
2874
2874
  const http = new Http({});
2875
2875
  let ProxyInfo = await http.api({
2876
2876
  method: "GET",
2877
- url: "https://fetdev.iflysec.com/api/publish/zdy/ip",
2877
+ url: "https://preview.huiwen.top/api/publish/zdy/ip",
2878
2878
  params: {
2879
2879
  addr: adr
2880
- }
2880
+ },
2881
+ ...huiwenToken ? {
2882
+ headers: {
2883
+ token: huiwenToken
2884
+ }
2885
+ } : null
2881
2886
  });
2882
2887
  return 0 === ProxyInfo.code && ProxyInfo.data.length > 0 ? new dist.HttpsProxyAgent(`http://${ProxyData.api}:${ProxyData.akey}@${ProxyInfo.data[0].proxyAddress}`) : null;
2883
2888
  };
@@ -2890,11 +2895,12 @@ class Http {
2890
2895
  data: error
2891
2896
  };
2892
2897
  }
2893
- constructor(config, adr){
2898
+ constructor(config, adr, huiwenToken){
2894
2899
  this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create({
2895
2900
  ...config
2896
2901
  });
2897
2902
  this.adr = adr;
2903
+ this.heiwenToken = huiwenToken;
2898
2904
  }
2899
2905
  addResponseInterceptor(findError) {
2900
2906
  this.apiClient.interceptors.response.use((response)=>{
@@ -2928,7 +2934,12 @@ class Http {
2928
2934
  }
2929
2935
  async api(config) {
2930
2936
  try {
2931
- const agent = this.adr ? await ProxyAgent(this.adr) : void 0;
2937
+ const agent = this.adr ? await ProxyAgent(this.adr, this.heiwenToken) : void 0;
2938
+ if (this.adr && null == agent) return Promise.reject({
2939
+ code: 200,
2940
+ message: "当前发文IP地址暂不支持!"
2941
+ });
2942
+ this.proxyInfo = agent?.proxy.host;
2932
2943
  const response = await this.apiClient({
2933
2944
  ...config,
2934
2945
  ...agent ? {
@@ -3285,9 +3296,9 @@ const mockAction = async (task, params)=>{
3285
3296
  const isDraft = "draft" === params.saveType;
3286
3297
  const saveUrl = isDraft ? "https://baijiahao.baidu.com/pcui/article/save?callback=bjhdraft" : "https://baijiahao.baidu.com/pcui/article/publish?callback=bjhpublish";
3287
3298
  task._timerRecord['PrePublish'] = Date.now();
3288
- const proxyHttp = new Http({
3299
+ const proxyHttp = task?.isBeta ?? false ? new Http({
3289
3300
  headers
3290
- }, params.proxyLoc);
3301
+ }, params.proxyLoc, params.huiwenToken) : http;
3291
3302
  const res = await proxyHttp.api({
3292
3303
  method: "post",
3293
3304
  url: saveUrl,
@@ -3299,7 +3310,7 @@ const mockAction = async (task, params)=>{
3299
3310
  },
3300
3311
  defaultErrorMsg: isDraft ? "文章同步出现异常,请稍后重试。" : "文章发布出现异常,请稍后重试。"
3301
3312
  });
3302
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(res.ret.article_id, "百家号发布完成。");
3313
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(0 == res.errno ? res?.ret?.article_id || '' : "", 0 == res.errno ? `文章发布成功!` + (proxyHttp.proxyInfo || "") : res.errmsg ?? '文章发布失败,请稍后重试。');
3303
3314
  };
3304
3315
  const rpaAction = async (task, params)=>{
3305
3316
  const tmpCachePath = task.getTmpPath();
@@ -4247,11 +4258,14 @@ const mock_mockAction = async (task, params)=>{
4247
4258
  device_platform: "mp",
4248
4259
  is_message: 0
4249
4260
  },
4250
- tuwen_wtt_trans_flag: "0",
4261
+ tuwen_wtt_trans_flag: params.settingInfo?.toutiaoTransWtt ? "2" : "0",
4251
4262
  info_source: sourceData,
4252
4263
  ...location ? {
4253
4264
  city: location.label,
4254
4265
  city_code: location.value
4266
+ } : null,
4267
+ ...params.settingInfo?.toutiaoCollectionId ? {
4268
+ want_join_collection_id: params.settingInfo.toutiaoCollectionId
4255
4269
  } : null
4256
4270
  };
4257
4271
  const publishData = {
@@ -4329,11 +4343,11 @@ const mock_mockAction = async (task, params)=>{
4329
4343
  },
4330
4344
  defaultErrorMsg: "draft" === params.saveType ? "文章同步异常,请稍后重试。" : "文章发布异常,请稍后重试。"
4331
4345
  };
4332
- const proxyHttp = new Http({
4346
+ const proxyHttp = task?.isBeta ?? false ? new Http({
4333
4347
  headers
4334
- }, params.proxyLoc);
4348
+ }, params.proxyLoc, params.huiwenToken) : http;
4335
4349
  const publishResult = await proxyHttp.api(publishOption);
4336
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id);
4350
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data.pgc_id, `文章发布成功!` + (proxyHttp.proxyInfo || ""));
4337
4351
  };
4338
4352
  const rpa_GenAB = __webpack_require__("./src/utils/ttABEncrypt.js");
4339
4353
  const rpa_rpaAction = async (task, params)=>{
@@ -5286,10 +5300,10 @@ async function handleBaijiahaoData(params) {
5286
5300
  }
5287
5301
  const final = filtered.slice(0, pageSize);
5288
5302
  const articleCell = final.map((item)=>({
5289
- title: item.title,
5290
- imageUrl: JSON.parse(item.cover_images)[0].src,
5303
+ title: item?.is_transfer ?? false ? item.content || "" : item.title,
5304
+ imageUrl: JSON.parse(item.cover_images)[0]?.src || "",
5291
5305
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
5292
- redirectUrl: item.url,
5306
+ redirectUrl: item.url || item.share_url,
5293
5307
  recommendNum: item.rec_amount | item.forward_num,
5294
5308
  collectNum: item.collection_amount,
5295
5309
  readNum: item.read_amount | item.read_num,
@@ -6191,9 +6205,6 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
6191
6205
  };
6192
6206
  const uuid = getUuidResult.uuid;
6193
6207
  await (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.sleep)(1000);
6194
- new Http({
6195
- headers
6196
- }, params.proxyLoc);
6197
6208
  const qrcodeResult = await http.api({
6198
6209
  method: "get",
6199
6210
  url: "https://mp.weixin.qq.com/safe/safeqrcode",
@@ -6268,7 +6279,10 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
6268
6279
  uuid
6269
6280
  })
6270
6281
  });
6271
- await http.api({
6282
+ const proxyHttp = task?.isBeta ?? false ? new Http({
6283
+ headers
6284
+ }, params.proxyLoc, params.huiwenToken) : http;
6285
+ await proxyHttp.api({
6272
6286
  method: "post",
6273
6287
  url: "https://mp.weixin.qq.com/cgi-bin/masssend",
6274
6288
  params: {
@@ -6317,7 +6331,7 @@ const weixinPublish_mock_mockAction = async (task, params)=>{
6317
6331
  }),
6318
6332
  defaultErrorMsg: params.masssend ? "文章群发异常,请尝试关闭群发或稍后重试。" : "文章发布异常,请稍后重试。"
6319
6333
  });
6320
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, params.settingInfo.timer ? "微信公众号文章定时发布成功。" : "微信公众号发布完成。");
6334
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(appMsgId, `微信公众号发布完成!` + (proxyHttp.proxyInfo || ""));
6321
6335
  };
6322
6336
  const waitQrcodeResultMaxTime = 2000 * scanRetryMaxCount;
6323
6337
  const weixinPublish_rpa_rpaAction = async (task, params)=>{
@@ -7205,9 +7219,9 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
7205
7219
  const publishXt = Date.now().toString();
7206
7220
  const publishXs = mock_xsEncrypt.signXsPost("/web_api/sns/v2/note", a1Cookie, "xhs-pc-web", publishData);
7207
7221
  const xscommon = GenXSCommon(a1Cookie, publishXt, publishXs);
7208
- const proxyHttp = new Http({
7222
+ const proxyHttp = task?.isBeta ?? false ? new Http({
7209
7223
  headers
7210
- }, params.proxyLoc);
7224
+ }, params.proxyLoc, params.huiwenToken) : http;
7211
7225
  task._timerRecord['PrePublish'] = Date.now();
7212
7226
  const publishResult = await proxyHttp.api({
7213
7227
  method: "post",
@@ -7220,7 +7234,7 @@ const xiaohongshuPublish_mock_mockAction = async (task, params)=>{
7220
7234
  },
7221
7235
  defaultErrorMsg: "文章发布异常,请稍后重试。"
7222
7236
  });
7223
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data?.id);
7237
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(publishResult.data?.id, `文章发布成功!` + (proxyHttp.proxyInfo || ""));
7224
7238
  };
7225
7239
  const rpa_GenXSCommon = __webpack_require__("./src/utils/XhsXsCommonEnc.js");
7226
7240
  const rpa_xsEncrypt = new Xhshow();
@@ -7441,9 +7455,7 @@ const xiaohongshuPublish = async (task, params)=>{
7441
7455
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
7442
7456
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
7443
7457
  };
7444
- var package_namespaceObject = {
7445
- i8: "1.2.23"
7446
- };
7458
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.24-beta.9"}');
7447
7459
  const BetaFlag = "HuiwenCanary";
7448
7460
  class Action {
7449
7461
  constructor(task){
@@ -7451,13 +7463,13 @@ class Action {
7451
7463
  }
7452
7464
  async bindTask(func, params) {
7453
7465
  let responseData;
7454
- this.task.isBeta = this.task.isFeatOn(BetaFlag);
7466
+ this.task.isBeta = this.task?.isFeatOn ? this.task?.isFeatOn(BetaFlag) : false;
7455
7467
  this.task._timerRecord = {
7456
7468
  ActionStart: Date.now()
7457
7469
  };
7458
- if (this.task.setArticleId) this.task.setArticleId(params.articleId ?? "");
7459
- if (this.task.setSaveType) this.task.setSaveType(params.saveType ?? "");
7460
- if (void 0 !== this.task.isInitializedGB) this.task.setGbInitType(this.task.isInitializedGB);
7470
+ if (this.task?.setArticleId) this.task.setArticleId(params.articleId ?? "");
7471
+ if (this.task?.setSaveType ?? false) this.task.setSaveType(params.saveType ?? "");
7472
+ if (this.task?.isInitializedGB !== void 0) this.task.setGbInitType(this.task.isInitializedGB);
7461
7473
  if ("object" == typeof params) params.cookies = params?.cookies ?? [];
7462
7474
  try {
7463
7475
  responseData = await func(this.task, params);