@iflyrpa/actions 1.2.5-beta.3 → 1.2.5
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/actions/weixinPublish/index.d.ts +1 -21
- package/dist/bundle.js +13 -470
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +13 -470
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -470
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +0 -12
- package/package.json +1 -5
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import type { CommonAction } from "@iflyrpa/share";
|
|
2
2
|
import type { ActiomCommonParams } from "../../types";
|
|
3
|
-
export interface WxInteraction {
|
|
4
|
-
Type: "public" | "private" | "off";
|
|
5
|
-
Option?: {
|
|
6
|
-
Comment: "已关注7天及以上的用户" | "已关注的用户" | "所有用户";
|
|
7
|
-
reply: "已关注7天及以上的用户" | "已关注的用户" | "所有用户";
|
|
8
|
-
elect_comment: boolean;
|
|
9
|
-
elect_reply: boolean;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
3
|
export interface WeixinPublishParams extends ActiomCommonParams {
|
|
13
4
|
saveType: "draft" | "publish";
|
|
14
5
|
masssend?: boolean;
|
|
@@ -23,23 +14,12 @@ export interface WeixinPublishParams extends ActiomCommonParams {
|
|
|
23
14
|
wxAuthor?: string;
|
|
24
15
|
wxAbstract?: string;
|
|
25
16
|
wxOriginalText?: string;
|
|
26
|
-
|
|
27
|
-
wxWhitelist?: string[];
|
|
28
|
-
wxRewardTarget?: Record<string, string>;
|
|
29
|
-
wxRewardText?: string;
|
|
17
|
+
wxFansMsg?: boolean;
|
|
30
18
|
wxQuickReprint?: boolean;
|
|
31
19
|
wxNotAllowRecommend?: boolean;
|
|
32
20
|
wxCreationSource?: string[];
|
|
33
|
-
wxInteraction?: WxInteraction;
|
|
34
21
|
};
|
|
35
22
|
safeQrcodeCallback?: (qrcodePath: string) => void;
|
|
36
23
|
}
|
|
37
|
-
export interface WxWhitelistUserInfo {
|
|
38
|
-
nickname: string;
|
|
39
|
-
openid: string;
|
|
40
|
-
username: string;
|
|
41
|
-
wx_name: string;
|
|
42
|
-
pic_url: string;
|
|
43
|
-
}
|
|
44
24
|
export type PublishAction = CommonAction<WeixinPublishParams, string>;
|
|
45
25
|
export declare const weixinPublish: PublishAction;
|
package/dist/bundle.js
CHANGED
|
@@ -13061,24 +13061,6 @@ var __webpack_exports__ = {};
|
|
|
13061
13061
|
}, html);
|
|
13062
13062
|
}
|
|
13063
13063
|
}
|
|
13064
|
-
function PopupListener(page, popupSelector, popKey, buttonSelector, options = {}) {
|
|
13065
|
-
const { checkInterval = 1000, stopAfterClick = false } = options;
|
|
13066
|
-
const popup = page.locator(popupSelector);
|
|
13067
|
-
const button = page.locator(buttonSelector);
|
|
13068
|
-
const intervalId = setInterval(async ()=>{
|
|
13069
|
-
try {
|
|
13070
|
-
if (await popup.count() > 0 && await popup.isVisible() && (await popup.textContent() || "").includes(popKey)) {
|
|
13071
|
-
await button.click({
|
|
13072
|
-
force: true
|
|
13073
|
-
});
|
|
13074
|
-
if (stopAfterClick) clearInterval(intervalId);
|
|
13075
|
-
}
|
|
13076
|
-
} catch (err) {}
|
|
13077
|
-
}, checkInterval);
|
|
13078
|
-
return ()=>{
|
|
13079
|
-
clearInterval(intervalId);
|
|
13080
|
-
};
|
|
13081
|
-
}
|
|
13082
13064
|
const parseUrlQueryString = (url)=>{
|
|
13083
13065
|
const queryStringObject = {};
|
|
13084
13066
|
if (!url || !url.includes("?")) return queryStringObject;
|
|
@@ -14054,25 +14036,13 @@ var __webpack_exports__ = {};
|
|
|
14054
14036
|
Normal: "kQuotaTypeMassSendNormal",
|
|
14055
14037
|
ProductActivity: "kQuotaTypeMassSendProductActivity"
|
|
14056
14038
|
};
|
|
14057
|
-
const GET_QRCODE_DEFAULT_ERROR = "
|
|
14039
|
+
const GET_QRCODE_DEFAULT_ERROR = "二维码获取异常,请稍后重试发布。";
|
|
14058
14040
|
const weixinPublish_mock_errnoMap = {
|
|
14059
|
-
200003: "微信公众号号登录状态失效,请重新绑定账号后重试。"
|
|
14060
|
-
420001: "封面图不支持GIF,请更换后重试。",
|
|
14061
|
-
200002: "上传图片参数错误,请检查后重试。",
|
|
14062
|
-
200039: "上传图片高度(像素)与宽度(像素)的乘积不能超过600万,请更换后重试。",
|
|
14063
|
-
153201: "不支持发布审核中或转码中的视频",
|
|
14064
|
-
200007: "登陆失败,请重新登陆账户后重试。",
|
|
14065
|
-
64703: "摘要超出120字长度限制,请修改摘要后重试。",
|
|
14066
|
-
"-4": "不支持发布审核中或转码中的视频"
|
|
14041
|
+
200003: "微信公众号号登录状态失效,请重新绑定账号后重试。"
|
|
14067
14042
|
};
|
|
14068
14043
|
const ignoreErrno = [
|
|
14069
14044
|
154019
|
|
14070
14045
|
];
|
|
14071
|
-
const userTypeMap = {
|
|
14072
|
-
所有用户: 1,
|
|
14073
|
-
已关注的用户: 2,
|
|
14074
|
-
已关注7天及以上的用户: 3
|
|
14075
|
-
};
|
|
14076
14046
|
const generatorFormData = (data)=>{
|
|
14077
14047
|
const formData = new URLSearchParams();
|
|
14078
14048
|
for (const [key, value] of Object.entries(data))formData.append(key, String(value));
|
|
@@ -14180,223 +14150,6 @@ var __webpack_exports__ = {};
|
|
|
14180
14150
|
const coverRes = await uploadImages([
|
|
14181
14151
|
params.settingInfo.wxCover
|
|
14182
14152
|
]);
|
|
14183
|
-
let oriWhitelist = null;
|
|
14184
|
-
if (params.settingInfo?.wxCopyright && params.settingInfo?.wxWhitelist) {
|
|
14185
|
-
const _oriWhitelist = params.settingInfo.wxWhitelist;
|
|
14186
|
-
if (_oriWhitelist && _oriWhitelist.length > 0) {
|
|
14187
|
-
const white_list = [];
|
|
14188
|
-
const white_list_user = {
|
|
14189
|
-
nickname: "",
|
|
14190
|
-
title: "可修改文章",
|
|
14191
|
-
openid: "",
|
|
14192
|
-
wx_name: "",
|
|
14193
|
-
username: "",
|
|
14194
|
-
avatar: "",
|
|
14195
|
-
can_modify: "1",
|
|
14196
|
-
can_hide_source: "0",
|
|
14197
|
-
can_reward: "0"
|
|
14198
|
-
};
|
|
14199
|
-
for (const _user of _oriWhitelist){
|
|
14200
|
-
const userInfo_res = await http.api({
|
|
14201
|
-
method: "post",
|
|
14202
|
-
url: "https://mp.weixin.qq.com/cgi-bin/appmsgcopyright?action=searchacct",
|
|
14203
|
-
params: {
|
|
14204
|
-
action: "searchacct"
|
|
14205
|
-
},
|
|
14206
|
-
data: generatorFormData({
|
|
14207
|
-
lang: "zh_CN",
|
|
14208
|
-
f: "json",
|
|
14209
|
-
ajax: 1,
|
|
14210
|
-
token: params.token,
|
|
14211
|
-
random: Math.random().toString(),
|
|
14212
|
-
username: _user
|
|
14213
|
-
}),
|
|
14214
|
-
defaultErrorMsg: "搜索用户信息失败"
|
|
14215
|
-
});
|
|
14216
|
-
if (!(userInfo_res.search_list.length > 0)) return {
|
|
14217
|
-
code: 200,
|
|
14218
|
-
message: `白名单用户:${_user} 未搜索到,请确定输入是否正确!`,
|
|
14219
|
-
data: ''
|
|
14220
|
-
};
|
|
14221
|
-
{
|
|
14222
|
-
let userInfo_resJson = userInfo_res.search_list[0];
|
|
14223
|
-
white_list_user.nickname = userInfo_resJson.nickname;
|
|
14224
|
-
white_list_user.openid = userInfo_resJson.openid;
|
|
14225
|
-
white_list_user.avatar = userInfo_resJson.pic_url;
|
|
14226
|
-
white_list_user.username = userInfo_resJson.username;
|
|
14227
|
-
white_list_user.wx_name = userInfo_resJson.wx_name;
|
|
14228
|
-
white_list.push({
|
|
14229
|
-
...white_list_user
|
|
14230
|
-
});
|
|
14231
|
-
}
|
|
14232
|
-
}
|
|
14233
|
-
oriWhitelist = white_list.length > 0 ? JSON.stringify({
|
|
14234
|
-
white_list: white_list
|
|
14235
|
-
}) : "";
|
|
14236
|
-
}
|
|
14237
|
-
}
|
|
14238
|
-
let writerid = null;
|
|
14239
|
-
let reply_id = null;
|
|
14240
|
-
if (params.settingInfo.wxCopyright && params.settingInfo.wxRewardTarget) {
|
|
14241
|
-
async function getWriterList() {
|
|
14242
|
-
const res = await http.api({
|
|
14243
|
-
method: "get",
|
|
14244
|
-
url: 'https://mp.weixin.qq.com/acct/writermgr',
|
|
14245
|
-
params: {
|
|
14246
|
-
action: 'get_writer_list',
|
|
14247
|
-
fingerprint,
|
|
14248
|
-
token: params.token,
|
|
14249
|
-
lang: "zh_CN",
|
|
14250
|
-
f: "json",
|
|
14251
|
-
ajax: 1
|
|
14252
|
-
}
|
|
14253
|
-
});
|
|
14254
|
-
return res.pageinfo.writerlist || [];
|
|
14255
|
-
}
|
|
14256
|
-
async function getRewardText() {
|
|
14257
|
-
const res = await http.api({
|
|
14258
|
-
method: "get",
|
|
14259
|
-
url: 'https://mp.weixin.qq.com/merchant/reward',
|
|
14260
|
-
params: {
|
|
14261
|
-
action: 'getautoreply',
|
|
14262
|
-
fingerprint,
|
|
14263
|
-
token: params.token,
|
|
14264
|
-
lang: "zh_CN",
|
|
14265
|
-
f: "json",
|
|
14266
|
-
ajax: 1
|
|
14267
|
-
}
|
|
14268
|
-
});
|
|
14269
|
-
return res.reply_infos;
|
|
14270
|
-
}
|
|
14271
|
-
for(var _type in params.settingInfo.wxRewardTarget)if ("author" === _type) {
|
|
14272
|
-
if (0 == (await getWriterList()).length) {
|
|
14273
|
-
const rewardbind = await http.api({
|
|
14274
|
-
method: "get",
|
|
14275
|
-
url: "https://mp.weixin.qq.com/acct/writermgr",
|
|
14276
|
-
params: {
|
|
14277
|
-
action: "get_rewardbind_qrcode",
|
|
14278
|
-
random: Math.random().toString(),
|
|
14279
|
-
fingerprint,
|
|
14280
|
-
token: params.token,
|
|
14281
|
-
lang: "zh_CN",
|
|
14282
|
-
f: "json",
|
|
14283
|
-
ajax: 1
|
|
14284
|
-
},
|
|
14285
|
-
defaultErrorMsg: GET_QRCODE_DEFAULT_ERROR
|
|
14286
|
-
});
|
|
14287
|
-
const rewardBuffer = Buffer.from(rewardbind.qrcode_base64, 'base64');
|
|
14288
|
-
const rewardFilePath = external_node_path_default().join(tmpCachePath, "weixin_reward.jpg");
|
|
14289
|
-
external_node_fs_default().writeFileSync(rewardFilePath, new Uint8Array(rewardBuffer));
|
|
14290
|
-
params.safeQrcodeCallback?.(rewardFilePath);
|
|
14291
|
-
const task_id = rewardbind.task_id;
|
|
14292
|
-
let code = null;
|
|
14293
|
-
for(let i = 0; i < scanRetryMaxCount; i++){
|
|
14294
|
-
await sleep(2000);
|
|
14295
|
-
const checkScanResult = await http.api({
|
|
14296
|
-
method: "get",
|
|
14297
|
-
url: "https://mp.weixin.qq.com/acct/writermgr",
|
|
14298
|
-
params: {
|
|
14299
|
-
action: "query_rewardbind_qrcode_status",
|
|
14300
|
-
task_id: task_id,
|
|
14301
|
-
fingerprint,
|
|
14302
|
-
lang: "zh_CN",
|
|
14303
|
-
f: "json",
|
|
14304
|
-
ajax: 1,
|
|
14305
|
-
token: params.token,
|
|
14306
|
-
timespam: Date.now()
|
|
14307
|
-
}
|
|
14308
|
-
});
|
|
14309
|
-
code = checkScanResult.qrcode_status;
|
|
14310
|
-
if (2 == code && (await getWriterList()).length > 0) break;
|
|
14311
|
-
if (i === scanRetryMaxCount - 1) return {
|
|
14312
|
-
code: 200,
|
|
14313
|
-
message: "二维码已过期,请重试绑定。",
|
|
14314
|
-
data: ""
|
|
14315
|
-
};
|
|
14316
|
-
}
|
|
14317
|
-
}
|
|
14318
|
-
let _writer = await getWriterList();
|
|
14319
|
-
for (var _writer_item of _writer)if (_writer_item.nickname === params.settingInfo.wxRewardTarget[_type]) writerid = _writer_item.writerid;
|
|
14320
|
-
if (!writerid) return {
|
|
14321
|
-
code: 200,
|
|
14322
|
-
message: "未匹配到赞赏绑定用户,请确认用户名与绑定是否正常!",
|
|
14323
|
-
data: ""
|
|
14324
|
-
};
|
|
14325
|
-
if (params.settingInfo?.wxRewardText) {
|
|
14326
|
-
let rewardList = await getRewardText();
|
|
14327
|
-
let matchdID = rewardList.find((reward)=>reward.text === params.settingInfo.wxRewardText)?.reply_id ?? null;
|
|
14328
|
-
if (0 != rewardList.length && matchdID) reply_id = matchdID;
|
|
14329
|
-
else await http.api({
|
|
14330
|
-
method: "post",
|
|
14331
|
-
url: 'https://mp.weixin.qq.com/merchant/reward',
|
|
14332
|
-
params: {
|
|
14333
|
-
action: 'addautoreply'
|
|
14334
|
-
},
|
|
14335
|
-
data: generatorFormData({
|
|
14336
|
-
type: 1,
|
|
14337
|
-
fingerprint,
|
|
14338
|
-
token: params.token,
|
|
14339
|
-
lang: "zh_CN",
|
|
14340
|
-
f: "json",
|
|
14341
|
-
ajax: 1,
|
|
14342
|
-
text: params.settingInfo.wxRewardText
|
|
14343
|
-
})
|
|
14344
|
-
});
|
|
14345
|
-
if (!matchdID) {
|
|
14346
|
-
for (var _reply_item of (await getRewardText()))reply_id = (await getRewardText()).find((reward)=>reward.text === params.settingInfo.wxRewardText)?.reply_id;
|
|
14347
|
-
if (!reply_id) return {
|
|
14348
|
-
code: 200,
|
|
14349
|
-
message: "赞赏文案添加失败,请重新检查",
|
|
14350
|
-
data: ""
|
|
14351
|
-
};
|
|
14352
|
-
}
|
|
14353
|
-
}
|
|
14354
|
-
}
|
|
14355
|
-
}
|
|
14356
|
-
const wxInteractionInfo = (()=>{
|
|
14357
|
-
const _wxInteraction = {
|
|
14358
|
-
need_open_comment0: 0,
|
|
14359
|
-
only_fans_can_comment0: 0,
|
|
14360
|
-
only_fans_days_can_comment0: 0,
|
|
14361
|
-
reply_flag0: 2,
|
|
14362
|
-
auto_elect_comment0: 0,
|
|
14363
|
-
auto_elect_reply0: 1,
|
|
14364
|
-
open_fansmsg0: 0
|
|
14365
|
-
};
|
|
14366
|
-
const type = params?.settingInfo?.wxInteraction?.Type ?? "";
|
|
14367
|
-
if ("public" === type) {
|
|
14368
|
-
const _opt = params?.settingInfo?.wxInteraction?.Option;
|
|
14369
|
-
if (!_opt || !_opt.Comment || !_opt.reply || null == _opt.elect_comment || null == _opt.elect_reply) return null;
|
|
14370
|
-
const commentType = userTypeMap[_opt.Comment];
|
|
14371
|
-
const replyType = userTypeMap[_opt.reply] + 1;
|
|
14372
|
-
_wxInteraction.need_open_comment0 = 1;
|
|
14373
|
-
switch(commentType){
|
|
14374
|
-
case 1:
|
|
14375
|
-
_wxInteraction.only_fans_can_comment0 = 0;
|
|
14376
|
-
_wxInteraction.only_fans_days_can_comment0 = 0;
|
|
14377
|
-
break;
|
|
14378
|
-
case 2:
|
|
14379
|
-
_wxInteraction.only_fans_can_comment0 = 1;
|
|
14380
|
-
_wxInteraction.only_fans_days_can_comment0 = 0;
|
|
14381
|
-
break;
|
|
14382
|
-
case 3:
|
|
14383
|
-
_wxInteraction.only_fans_can_comment0 = 0;
|
|
14384
|
-
_wxInteraction.only_fans_days_can_comment0 = 1;
|
|
14385
|
-
break;
|
|
14386
|
-
}
|
|
14387
|
-
_wxInteraction.reply_flag0 = replyType;
|
|
14388
|
-
_wxInteraction.auto_elect_comment0 = _opt.elect_comment ? userTypeMap[_opt.Comment] : 0;
|
|
14389
|
-
_wxInteraction.auto_elect_reply0 = _opt.elect_reply ? userTypeMap[_opt.reply] : 1;
|
|
14390
|
-
return _wxInteraction;
|
|
14391
|
-
}
|
|
14392
|
-
if ("private" === type) _wxInteraction.open_fansmsg0 = 1;
|
|
14393
|
-
return _wxInteraction;
|
|
14394
|
-
})();
|
|
14395
|
-
if (!wxInteractionInfo) return {
|
|
14396
|
-
code: 200,
|
|
14397
|
-
message: "互动参数设置错误,请检查参数设置!",
|
|
14398
|
-
data: ""
|
|
14399
|
-
};
|
|
14400
14153
|
const draftData = {
|
|
14401
14154
|
lang: "zh_CN",
|
|
14402
14155
|
f: "json",
|
|
@@ -14409,19 +14162,16 @@ var __webpack_exports__ = {};
|
|
|
14409
14162
|
is_finder_video0: 0,
|
|
14410
14163
|
finder_draft_id0: 0,
|
|
14411
14164
|
applyori0: 0,
|
|
14412
|
-
can_reward0:
|
|
14165
|
+
can_reward0: 0,
|
|
14413
14166
|
pay_gifts_count0: 0,
|
|
14414
14167
|
is_video_recommend0: -1,
|
|
14415
|
-
writerid0:
|
|
14168
|
+
writerid0: 0,
|
|
14416
14169
|
auto_gen_digest0: 0,
|
|
14417
14170
|
last_choose_cover_from0: 0,
|
|
14418
|
-
need_open_comment0:
|
|
14419
|
-
only_fans_can_comment0:
|
|
14420
|
-
only_fans_days_can_comment0:
|
|
14421
|
-
reply_flag0:
|
|
14422
|
-
auto_elect_comment0: wxInteractionInfo.auto_elect_comment0,
|
|
14423
|
-
auto_elect_reply0: wxInteractionInfo.auto_elect_reply0,
|
|
14424
|
-
reward_reply_id0: params.settingInfo?.wxRewardText ? reply_id ? reply_id : 0 : 0,
|
|
14171
|
+
need_open_comment0: 0,
|
|
14172
|
+
only_fans_can_comment0: 0,
|
|
14173
|
+
only_fans_days_can_comment0: 0,
|
|
14174
|
+
reply_flag0: 0,
|
|
14425
14175
|
not_pay_can_comment0: 0,
|
|
14426
14176
|
data_seq: 0,
|
|
14427
14177
|
msg_index_id0: "",
|
|
@@ -14433,11 +14183,7 @@ var __webpack_exports__ = {};
|
|
|
14433
14183
|
content0: content || "",
|
|
14434
14184
|
sourceurl0: params?.settingInfo?.wxOriginalText || "",
|
|
14435
14185
|
cdn_url0: coverRes[0].cdn_url || "",
|
|
14436
|
-
|
|
14437
|
-
allow_reprint0: params?.settingInfo?.wxCopyright ? 0 : '',
|
|
14438
|
-
allow_reprint_modify0: params?.settingInfo?.wxCopyright ? 0 : '',
|
|
14439
|
-
ori_white_list0: params?.settingInfo?.wxCopyright ? oriWhitelist : '',
|
|
14440
|
-
open_fansmsg0: wxInteractionInfo.open_fansmsg0,
|
|
14186
|
+
open_fansmsg0: params?.settingInfo?.wxFansMsg ? 1 : 0,
|
|
14441
14187
|
allow_fast_reprint0: params?.settingInfo?.wxQuickReprint ? 1 : 0,
|
|
14442
14188
|
disable_recommend0: params?.settingInfo?.wxNotAllowRecommend ? 1 : 0,
|
|
14443
14189
|
claim_source_type0: params?.settingInfo?.wxCreationSource?.[0] || "",
|
|
@@ -14788,81 +14534,6 @@ var __webpack_exports__ = {};
|
|
|
14788
14534
|
timestamp: Date.now(),
|
|
14789
14535
|
appmsgid: params.appMsgId
|
|
14790
14536
|
};
|
|
14791
|
-
if (params.settingInfo?.wxRewardTarget) {
|
|
14792
|
-
const urlRewardParams = {
|
|
14793
|
-
action: "inviteauthor",
|
|
14794
|
-
token: params.token,
|
|
14795
|
-
lang: "zh_CN"
|
|
14796
|
-
};
|
|
14797
|
-
const wxRewardPage = await task.createPage({
|
|
14798
|
-
show: task.debug,
|
|
14799
|
-
url: params.url || `https://mp.weixin.qq.com/cgi-bin/safecenterstatus?${Object.entries(urlRewardParams).map((it)=>it.join("=")).join("&")}`,
|
|
14800
|
-
cookies: params.cookies?.map((it)=>({
|
|
14801
|
-
...commonCookies,
|
|
14802
|
-
...it
|
|
14803
|
-
})) || []
|
|
14804
|
-
});
|
|
14805
|
-
const reward_page = wxRewardPage.locator("#app");
|
|
14806
|
-
const isAddRewarder = reward_page.locator('.author_card_bd.weui-desktop-vm_primary').filter({
|
|
14807
|
-
hasText: params.settingInfo.wxRewardTarget.author
|
|
14808
|
-
}).count();
|
|
14809
|
-
if (await isAddRewarder == 0) {
|
|
14810
|
-
await reward_page.locator('.weui-desktop-panel__hd-right').click();
|
|
14811
|
-
try {
|
|
14812
|
-
try {
|
|
14813
|
-
await wxRewardPage.waitForSelector('.invite-qrcode', {
|
|
14814
|
-
state: 'visible',
|
|
14815
|
-
timeout: 20000
|
|
14816
|
-
});
|
|
14817
|
-
const qrcodeSrc = await reward_page.locator(".invite-qrcode").getAttribute('src');
|
|
14818
|
-
if (qrcodeSrc) {
|
|
14819
|
-
const rewardBuffer = Buffer.from(qrcodeSrc.replace(/^data:image\/\w+;base64,/, ''), 'base64');
|
|
14820
|
-
const rewardFilePath = external_node_path_default().join(tmpCachePath, "weixin_reward.jpg");
|
|
14821
|
-
external_node_fs_default().writeFileSync(rewardFilePath, new Uint8Array(rewardBuffer));
|
|
14822
|
-
params.safeQrcodeCallback?.(rewardFilePath);
|
|
14823
|
-
}
|
|
14824
|
-
} catch (error) {
|
|
14825
|
-
throw new Error("二维码已过期,请重试绑定。");
|
|
14826
|
-
}
|
|
14827
|
-
for(let i = 0; i < scanRetryMaxCount; i++){
|
|
14828
|
-
await Promise.all([
|
|
14829
|
-
wxRewardPage.reload(),
|
|
14830
|
-
wxRewardPage.waitForLoadState('domcontentloaded')
|
|
14831
|
-
]);
|
|
14832
|
-
try {
|
|
14833
|
-
await wxRewardPage.waitForSelector(`.author_card_bd.weui-desktop-vm_primary:has-text("${params.settingInfo.wxRewardTarget?.author}")`, {
|
|
14834
|
-
timeout: 1000
|
|
14835
|
-
});
|
|
14836
|
-
break;
|
|
14837
|
-
} catch (error) {}
|
|
14838
|
-
if (i === scanRetryMaxCount - 1) throw new Error("未确认绑定账户,请在手机端确认绑定并重试");
|
|
14839
|
-
}
|
|
14840
|
-
} catch (error) {
|
|
14841
|
-
let errorMessage = "发生未知错误";
|
|
14842
|
-
if (error instanceof Error) errorMessage = error.message;
|
|
14843
|
-
else if ("string" == typeof error) errorMessage = error;
|
|
14844
|
-
await wxRewardPage.close();
|
|
14845
|
-
return {
|
|
14846
|
-
code: 200,
|
|
14847
|
-
message: errorMessage,
|
|
14848
|
-
data: ""
|
|
14849
|
-
};
|
|
14850
|
-
}
|
|
14851
|
-
}
|
|
14852
|
-
if (params.settingInfo.wxRewardText) {
|
|
14853
|
-
await wxRewardPage.locator('[href="/merchant/reward?action=getautoreply"]').click();
|
|
14854
|
-
await wxRewardPage.waitForLoadState('networkidle');
|
|
14855
|
-
const isAddWord = reward_page.locator(".auto-reply__list.edit .auto-reply__hd .auto-reply__text").filter({
|
|
14856
|
-
hasText: new RegExp(`^${params.settingInfo.wxRewardText}$`)
|
|
14857
|
-
}).count();
|
|
14858
|
-
if (await isAddWord == 0) {
|
|
14859
|
-
await reward_page.locator(".emotion_editor .edit_area").fill(params.settingInfo.wxRewardText);
|
|
14860
|
-
await reward_page.locator(".emotion_editor .edit_area").click();
|
|
14861
|
-
await reward_page.locator(".editor_toolbar .weui-desktop-btn.weui-desktop-btn_primary").click();
|
|
14862
|
-
}
|
|
14863
|
-
}
|
|
14864
|
-
await wxRewardPage.close();
|
|
14865
|
-
}
|
|
14866
14537
|
const page = await task.createPage({
|
|
14867
14538
|
show: task.debug,
|
|
14868
14539
|
url: params.url || `https://mp.weixin.qq.com/cgi-bin/appmsg?${Object.entries(urlParams).map((it)=>it.join("=")).join("&")}`,
|
|
@@ -14885,10 +14556,6 @@ var __webpack_exports__ = {};
|
|
|
14885
14556
|
await page.waitForSelector("#editor_pannel", {
|
|
14886
14557
|
state: "visible"
|
|
14887
14558
|
});
|
|
14888
|
-
PopupListener(page, '[v-transfer-dom="#vue_app"] .weui-desktop-dialog', "更新", '[v-transfer-dom="#vue_app"] .weui-desktop-icon-btn.weui-desktop-dialog__close-btn', {
|
|
14889
|
-
checkInterval: 1000,
|
|
14890
|
-
stopAfterClick: false
|
|
14891
|
-
});
|
|
14892
14559
|
const titleInstance = page.locator("#js_title_main textarea#title");
|
|
14893
14560
|
await titleInstance.click();
|
|
14894
14561
|
await titleInstance.fill(params.title);
|
|
@@ -14930,15 +14597,7 @@ var __webpack_exports__ = {};
|
|
|
14930
14597
|
await page.waitForSelector(".weui-desktop-img-picker__list .weui-desktop-img-picker__item.selected", {
|
|
14931
14598
|
state: "visible"
|
|
14932
14599
|
});
|
|
14933
|
-
await page.
|
|
14934
|
-
state: 'detached'
|
|
14935
|
-
});
|
|
14936
|
-
const pic_msg = page.locator('.weui-desktop-img-picker__list .weui-desktop-img-picker__item.selected .weui-desktop-upload__file__msg');
|
|
14937
|
-
if (await pic_msg.count() > 0) return {
|
|
14938
|
-
code: 200,
|
|
14939
|
-
message: "图片上传错误:" + (await pic_msg.textContent() || "未知错误,请重试!"),
|
|
14940
|
-
data: ""
|
|
14941
|
-
};
|
|
14600
|
+
await page.waitForTimeout(1000);
|
|
14942
14601
|
await dialog.locator(".weui-desktop-dialog__ft .weui-desktop-btn:not(.weui-desktop-btn_disabled)").filter({
|
|
14943
14602
|
hasText: "下一步"
|
|
14944
14603
|
}).click();
|
|
@@ -14951,124 +14610,6 @@ var __webpack_exports__ = {};
|
|
|
14951
14610
|
hasText: "确认"
|
|
14952
14611
|
}).click();
|
|
14953
14612
|
}
|
|
14954
|
-
if (params.settingInfo.wxCopyright) {
|
|
14955
|
-
await page.locator('#js_original').click();
|
|
14956
|
-
const ori_dialog = page.locator('.claim__original-dialog.original_dialog');
|
|
14957
|
-
const ori_dialog_bd = ori_dialog.locator('.weui-desktop-dialog__bd');
|
|
14958
|
-
const ori_dialog_ft = ori_dialog.locator('.weui-desktop-dialog__ft');
|
|
14959
|
-
await ori_dialog_bd.locator('.weui-desktop-form__check-content').filter({
|
|
14960
|
-
hasText: "文字原创"
|
|
14961
|
-
}).click();
|
|
14962
|
-
if (params.settingInfo?.wxWhitelist) for (var _target of params.settingInfo.wxWhitelist){
|
|
14963
|
-
await ori_dialog_bd.locator('#js_article_whitelist_search').fill(_target);
|
|
14964
|
-
await ori_dialog_bd.locator('.js_search').click();
|
|
14965
|
-
const search_res = ori_dialog_bd.locator('#js_article_whitelist_search_result > div');
|
|
14966
|
-
await page.waitForTimeout(1000);
|
|
14967
|
-
if (await search_res.getAttribute('class') === 'search-result-title search-result-empty') return {
|
|
14968
|
-
code: 200,
|
|
14969
|
-
message: `白名单用户:${_target} 未搜索到,请确定输入是否正确!`,
|
|
14970
|
-
data: ''
|
|
14971
|
-
};
|
|
14972
|
-
{
|
|
14973
|
-
const search_res_name = await search_res.locator('.search-result-name-left').textContent() || void 0;
|
|
14974
|
-
await search_res.click();
|
|
14975
|
-
const whrite_list = ori_dialog_bd.locator('#js_article_whitelist_added tbody');
|
|
14976
|
-
const white_td_isadd = await whrite_list.locator('.table-td-name').filter({
|
|
14977
|
-
hasText: search_res_name
|
|
14978
|
-
}).count();
|
|
14979
|
-
if (!white_td_isadd) return {
|
|
14980
|
-
code: 200,
|
|
14981
|
-
message: '白名单添加失败,请重试!',
|
|
14982
|
-
data: ''
|
|
14983
|
-
};
|
|
14984
|
-
}
|
|
14985
|
-
}
|
|
14986
|
-
if (params.settingInfo?.wxQuickReprint) {
|
|
14987
|
-
const btn_isChecked = await ori_dialog_bd.locator('//span[@class="frm_tips"]').filter({
|
|
14988
|
-
hasText: '已开启'
|
|
14989
|
-
}).count() == 1;
|
|
14990
|
-
if (!btn_isChecked) await ori_dialog_bd.locator('.weui-desktop-switch_loading .weui-desktop-switch__box').click();
|
|
14991
|
-
}
|
|
14992
|
-
const checkbox = ori_dialog_ft.locator('.weui-desktop-icon-checkbox');
|
|
14993
|
-
if (!await checkbox.isChecked()) await checkbox.check();
|
|
14994
|
-
await ori_dialog_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
|
|
14995
|
-
if (params.settingInfo?.wxRewardTarget) {
|
|
14996
|
-
await page.locator('#js_reward_setting_area').click();
|
|
14997
|
-
const reward_setting = page.locator('.reward-setting-dialog');
|
|
14998
|
-
const reward_setting_bd = reward_setting.locator('.weui-desktop-dialog__bd');
|
|
14999
|
-
const reward_setting_ft = reward_setting.locator('.weui-desktop-dialog__ft');
|
|
15000
|
-
for(var _type in params.settingInfo.wxRewardTarget)if ("author" === _type) {
|
|
15001
|
-
let userName = params.settingInfo.wxRewardTarget[_type];
|
|
15002
|
-
await reward_setting_bd.locator('.weui-desktop-form__check-label', {
|
|
15003
|
-
hasText: '赞赏作者'
|
|
15004
|
-
}).click();
|
|
15005
|
-
await reward_setting_bd.locator('.weui-desktop-form__input').fill(userName);
|
|
15006
|
-
if (params.settingInfo.wxRewardText) {
|
|
15007
|
-
const reward_setting_replay = page.locator('.reward-reply-setting');
|
|
15008
|
-
const switchAuto = reward_setting_replay.locator('.weui-desktop-switch__box');
|
|
15009
|
-
const maxAttempts = 5;
|
|
15010
|
-
const delayMs = 500;
|
|
15011
|
-
let nowCheckTime = 0;
|
|
15012
|
-
for(let attempt = 0; attempt < maxAttempts; attempt++){
|
|
15013
|
-
const isDisabled = await switchAuto.isDisabled();
|
|
15014
|
-
if (!isDisabled) {
|
|
15015
|
-
await switchAuto.isChecked() && nowCheckTime++;
|
|
15016
|
-
if (2 == nowCheckTime) break;
|
|
15017
|
-
}
|
|
15018
|
-
if (attempt === maxAttempts - 1) throw new Error('Checkbox did not become enabled within the timeout.');
|
|
15019
|
-
await new Promise((resolve)=>setTimeout(resolve, delayMs));
|
|
15020
|
-
}
|
|
15021
|
-
const isOneReplay = await reward_setting_replay.locator('.reward-reply-select__wrp >.reward-reply-select__tips').textContent() == "添加新的回复";
|
|
15022
|
-
const isCurrentReplay = await reward_setting_replay.locator('.reward-reply-select__wrp >.reward-reply-select__display .wording').filter({
|
|
15023
|
-
hasText: new RegExp(`^${[
|
|
15024
|
-
params.settingInfo.wxRewardText
|
|
15025
|
-
]}$`)
|
|
15026
|
-
}).count() == 1;
|
|
15027
|
-
if (!isOneReplay && !isCurrentReplay) {
|
|
15028
|
-
await reward_setting_replay.locator('.reward-reply-select__wrp >.reward-reply-select__tips').click();
|
|
15029
|
-
await reward_setting_replay.locator('.reward-reply-select__display.can-select .wording').filter({
|
|
15030
|
-
hasText: new RegExp(`^${[
|
|
15031
|
-
params.settingInfo.wxRewardText
|
|
15032
|
-
]}$`)
|
|
15033
|
-
}).click();
|
|
15034
|
-
}
|
|
15035
|
-
} else await reward_setting_bd.locator('.reward-reply-setting .weui-desktop-switch__input').isChecked() && reward_setting_bd.locator('.reward-reply-setting .weui-desktop-switch__box').uncheck();
|
|
15036
|
-
}
|
|
15037
|
-
const checkbox = reward_setting_ft.locator('.weui-desktop-icon-checkbox');
|
|
15038
|
-
if (!await checkbox.isChecked()) await checkbox.check();
|
|
15039
|
-
await reward_setting_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
|
|
15040
|
-
}
|
|
15041
|
-
}
|
|
15042
|
-
if (params.settingInfo?.wxInteraction) {
|
|
15043
|
-
await page.locator('.appmsg-editor__setting-group.js_interaction_cell').click();
|
|
15044
|
-
const wxInteraction_setting = page.locator('.interaction-dialog');
|
|
15045
|
-
const wxInteraction_bd = wxInteraction_setting.locator('.weui-desktop-dialog__bd');
|
|
15046
|
-
const wxInteraction_ft = wxInteraction_setting.locator('.weui-desktop-dialog__ft');
|
|
15047
|
-
if ("public" == params.settingInfo.wxInteraction.Type) {
|
|
15048
|
-
await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
15049
|
-
hasText: '留言'
|
|
15050
|
-
}).click();
|
|
15051
|
-
const comment_area = wxInteraction_bd.locator('.comment-options-block.pt0');
|
|
15052
|
-
const reply_area = wxInteraction_bd.locator('.comment-options-block.bb0.pb0');
|
|
15053
|
-
const commont_rply_opt = page.locator('.weui-desktop-popper.options-popover[x-placement="bottom"]');
|
|
15054
|
-
await comment_area.locator('.comment-options__selector-btn').click();
|
|
15055
|
-
await commont_rply_opt.locator('.weui-desktop-form__check-label', {
|
|
15056
|
-
hasText: params.settingInfo.wxInteraction.Option?.Comment
|
|
15057
|
-
}).click();
|
|
15058
|
-
if (params.settingInfo.wxInteraction.Option?.elect_comment) await comment_area.locator('.weui-desktop-switch__box').check();
|
|
15059
|
-
else await comment_area.locator('.weui-desktop-switch__input').isChecked() && comment_area.locator('.weui-desktop-switch__box').uncheck();
|
|
15060
|
-
await page.waitForTimeout(1000);
|
|
15061
|
-
await reply_area.locator('.comment-options__selector-btn').click();
|
|
15062
|
-
await commont_rply_opt.locator('.weui-desktop-form__check-label', {
|
|
15063
|
-
hasText: params.settingInfo.wxInteraction.Option?.reply
|
|
15064
|
-
}).click();
|
|
15065
|
-
if (params.settingInfo.wxInteraction.Option?.elect_reply) await reply_area.locator('.weui-desktop-switch__box').check();
|
|
15066
|
-
else await reply_area.locator('.weui-desktop-switch__input').isChecked() && reply_area.locator('.weui-desktop-switch__box').uncheck();
|
|
15067
|
-
} else if ("private" == params.settingInfo.wxInteraction.Type) await wxInteraction_bd.locator('.weui-desktop-form__check-label', {
|
|
15068
|
-
hasText: '快捷私信'
|
|
15069
|
-
}).click();
|
|
15070
|
-
await wxInteraction_ft.locator('.weui-desktop-btn.weui-desktop-btn_primary').click();
|
|
15071
|
-
}
|
|
15072
14613
|
if (params.settingInfo.wxOriginalText) {
|
|
15073
14614
|
await page.locator("#js_article_url_area .allow_click_opr").click();
|
|
15074
14615
|
await page.waitForTimeout(200);
|
|
@@ -15806,7 +15347,9 @@ var __webpack_exports__ = {};
|
|
|
15806
15347
|
if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
|
|
15807
15348
|
return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
|
|
15808
15349
|
};
|
|
15809
|
-
var package_namespaceObject =
|
|
15350
|
+
var package_namespaceObject = {
|
|
15351
|
+
i8: "1.2.4"
|
|
15352
|
+
};
|
|
15810
15353
|
class Action {
|
|
15811
15354
|
constructor(task){
|
|
15812
15355
|
this.task = task;
|