@iflyrpa/actions 4.0.0-beta.10 → 4.0.0-beta.13
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 +24 -82
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +21 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5434,7 +5434,7 @@ function __webpack_require__(moduleId) {
|
|
|
5434
5434
|
return module;
|
|
5435
5435
|
};
|
|
5436
5436
|
})();
|
|
5437
|
-
var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.
|
|
5437
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.0-beta.13"}');
|
|
5438
5438
|
var dist = __webpack_require__("../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js");
|
|
5439
5439
|
async function ProxyAgent(task, ip, adr, accountId, refresh) {
|
|
5440
5440
|
const http = new Http({
|
|
@@ -11820,35 +11820,16 @@ const WxSessionCheck = async (_task, params)=>{
|
|
|
11820
11820
|
}, "微信账号有效性检测完成!");
|
|
11821
11821
|
};
|
|
11822
11822
|
const XhsSessionCheck = async (_task, params)=>{
|
|
11823
|
-
const logger = _task.logger;
|
|
11824
|
-
const startedAt = Date.now();
|
|
11825
11823
|
const check = {
|
|
11826
11824
|
isValidSession: false,
|
|
11827
11825
|
isValidWebSession: false
|
|
11828
11826
|
};
|
|
11829
|
-
const cookieNames = params.cookies.map((it)=>it.name);
|
|
11830
|
-
logger?.info("[XhsSessionCheck] 开始执行小红书账号有效性检测", {
|
|
11831
|
-
accountId: params.accountId,
|
|
11832
|
-
proxyLoc: params.proxyLoc,
|
|
11833
|
-
localIP: params.localIP,
|
|
11834
|
-
willUseProxyAgent: !!params.localIP,
|
|
11835
|
-
cookieCount: params.cookies.length,
|
|
11836
|
-
cookieNames,
|
|
11837
|
-
hasA1: cookieNames.includes("a1"),
|
|
11838
|
-
hasWebSession: cookieNames.includes("web_session")
|
|
11839
|
-
});
|
|
11840
11827
|
const a1Cookie = params.cookies.find((it)=>"a1" === it.name)?.value;
|
|
11841
|
-
if (!a1Cookie) {
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
return {
|
|
11847
|
-
code: 414,
|
|
11848
|
-
message: "账号数据异常,请重新绑定账号后重试。",
|
|
11849
|
-
data: check
|
|
11850
|
-
};
|
|
11851
|
-
}
|
|
11828
|
+
if (!a1Cookie) return {
|
|
11829
|
+
code: 414,
|
|
11830
|
+
message: "账号数据异常,请重新绑定账号后重试。",
|
|
11831
|
+
data: check
|
|
11832
|
+
};
|
|
11852
11833
|
const headers = {
|
|
11853
11834
|
cookie: params.cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
|
|
11854
11835
|
referer: "https://creator.xiaohongshu.com/new/home?source=official"
|
|
@@ -11876,7 +11857,6 @@ const XhsSessionCheck = async (_task, params)=>{
|
|
|
11876
11857
|
return acc;
|
|
11877
11858
|
}, {});
|
|
11878
11859
|
const loginBaseXsHeader = sessionCheck_xsEncrypt.signHeadersGet(loginBasePath, recordCookie, "xhs-pc-web", null);
|
|
11879
|
-
const baseInfoStart = Date.now();
|
|
11880
11860
|
const _baseInfo = http.api({
|
|
11881
11861
|
method: "get",
|
|
11882
11862
|
baseURL: "https://creator.xiaohongshu.com",
|
|
@@ -11886,28 +11866,7 @@ const XhsSessionCheck = async (_task, params)=>{
|
|
|
11886
11866
|
retries: 3,
|
|
11887
11867
|
retryDelay: 20,
|
|
11888
11868
|
timeout: 3000
|
|
11889
|
-
}).
|
|
11890
|
-
logger?.info("[XhsSessionCheck] creator base 接口请求成功", {
|
|
11891
|
-
accountId: params.accountId,
|
|
11892
|
-
duration: Date.now() - baseInfoStart,
|
|
11893
|
-
code: res?.code,
|
|
11894
|
-
msg: res?.msg,
|
|
11895
|
-
proxyInfo: http.proxyInfo
|
|
11896
|
-
});
|
|
11897
|
-
return res;
|
|
11898
|
-
}).catch((e)=>{
|
|
11899
|
-
logger?.warn("[XhsSessionCheck] creator base 接口请求失败", {
|
|
11900
|
-
accountId: params.accountId,
|
|
11901
|
-
duration: Date.now() - baseInfoStart,
|
|
11902
|
-
code: e?.code,
|
|
11903
|
-
message: e?.message,
|
|
11904
|
-
data: e?.data,
|
|
11905
|
-
extra: e?.extra,
|
|
11906
|
-
proxyInfo: http.proxyInfo
|
|
11907
|
-
});
|
|
11908
|
-
return e.data;
|
|
11909
|
-
});
|
|
11910
|
-
const webSessionStart = Date.now();
|
|
11869
|
+
}).catch((e)=>e.data);
|
|
11911
11870
|
const _web_session = http.api({
|
|
11912
11871
|
method: "get",
|
|
11913
11872
|
url: "https://edith.xiaohongshu.com/api/sns/web/unread_count"
|
|
@@ -11915,26 +11874,6 @@ const XhsSessionCheck = async (_task, params)=>{
|
|
|
11915
11874
|
retries: 3,
|
|
11916
11875
|
retryDelay: 20,
|
|
11917
11876
|
timeout: 3000
|
|
11918
|
-
}).then((res)=>{
|
|
11919
|
-
logger?.info("[XhsSessionCheck] edith unread_count 接口请求成功", {
|
|
11920
|
-
accountId: params.accountId,
|
|
11921
|
-
duration: Date.now() - webSessionStart,
|
|
11922
|
-
code: res?.code,
|
|
11923
|
-
msg: res?.msg,
|
|
11924
|
-
proxyInfo: http.proxyInfo
|
|
11925
|
-
});
|
|
11926
|
-
return res;
|
|
11927
|
-
}).catch((e)=>{
|
|
11928
|
-
logger?.warn("[XhsSessionCheck] edith unread_count 接口请求失败", {
|
|
11929
|
-
accountId: params.accountId,
|
|
11930
|
-
duration: Date.now() - webSessionStart,
|
|
11931
|
-
code: e?.code,
|
|
11932
|
-
message: e?.message,
|
|
11933
|
-
data: e?.data,
|
|
11934
|
-
extra: e?.extra,
|
|
11935
|
-
proxyInfo: http.proxyInfo
|
|
11936
|
-
});
|
|
11937
|
-
throw e;
|
|
11938
11877
|
});
|
|
11939
11878
|
const [baseInfo, web_session] = await Promise.all([
|
|
11940
11879
|
_baseInfo,
|
|
@@ -11942,18 +11881,8 @@ const XhsSessionCheck = async (_task, params)=>{
|
|
|
11942
11881
|
]);
|
|
11943
11882
|
if (baseInfo?.code === 0) check.isValidSession = true;
|
|
11944
11883
|
if (0 === web_session.code) check.isValidWebSession = true;
|
|
11945
|
-
|
|
11884
|
+
baseInfo?.code, web_session.code;
|
|
11946
11885
|
const message = `小红书账号有效性检测成功${_task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
11947
|
-
logger?.info("[XhsSessionCheck] 检测完成", {
|
|
11948
|
-
accountId: params.accountId,
|
|
11949
|
-
totalDuration: Date.now() - startedAt,
|
|
11950
|
-
baseInfoCode: baseInfo?.code,
|
|
11951
|
-
webSessionCode: web_session?.code,
|
|
11952
|
-
isValidSession: check.isValidSession,
|
|
11953
|
-
isValidWebSession: check.isValidWebSession,
|
|
11954
|
-
codeAligned: _isSuccess,
|
|
11955
|
-
proxyInfo: http.proxyInfo
|
|
11956
|
-
});
|
|
11957
11886
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(check, message);
|
|
11958
11887
|
};
|
|
11959
11888
|
const BjhSessionCheck = async (_task, params)=>{
|
|
@@ -14523,8 +14452,19 @@ const mock_mockAction = async (task, params)=>{
|
|
|
14523
14452
|
task.logger.error(`解析 webProtectData 失败: ${error}`);
|
|
14524
14453
|
return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.response)(414, "安全参数 webProtectData 解析失败,请重新获取后重试", "");
|
|
14525
14454
|
}
|
|
14526
|
-
|
|
14527
|
-
|
|
14455
|
+
let ticket = webProtectData.ticket;
|
|
14456
|
+
let ts_sign = webProtectData.ts_sign;
|
|
14457
|
+
const serverDataCookie = params.cookies.find((it)=>"bd_ticket_guard_server_data" === it.name)?.value;
|
|
14458
|
+
if (serverDataCookie) try {
|
|
14459
|
+
const decoded = JSON.parse(Buffer.from(decodeURIComponent(serverDataCookie), "base64").toString("utf8"));
|
|
14460
|
+
if (decoded.ticket && decoded.ts_sign) {
|
|
14461
|
+
if (decoded.ticket !== ticket) task.logger.info("使用 cookie 中的最新 ticket(web_protect 已过期)");
|
|
14462
|
+
ticket = decoded.ticket;
|
|
14463
|
+
ts_sign = decoded.ts_sign;
|
|
14464
|
+
}
|
|
14465
|
+
} catch (error) {
|
|
14466
|
+
task.logger.warn(`解析 bd_ticket_guard_server_data 失败,回退到 web_protect: ${error}`);
|
|
14467
|
+
}
|
|
14528
14468
|
let ec_privateKey;
|
|
14529
14469
|
try {
|
|
14530
14470
|
ec_privateKey = JSON.parse(JSON.parse(params.extraParam["security-sdk/s_sdk_crypt_sdk"] || "{}").data || "{}").ec_privateKey;
|