tt-help-cli-ycl 1.3.87 → 1.3.88
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/package.json +1 -1
- package/src/lib/browser/page.js +17 -4
package/package.json
CHANGED
package/src/lib/browser/page.js
CHANGED
|
@@ -94,7 +94,13 @@ export async function isLoggedIn(page) {
|
|
|
94
94
|
console.error(
|
|
95
95
|
` [登录检测] DOM 无法判断,刷新页面后重试 (${attempt}/${DOM_CHECK_RETRIES})...`,
|
|
96
96
|
);
|
|
97
|
-
|
|
97
|
+
try {
|
|
98
|
+
await page.reload({ waitUntil: "domcontentloaded", timeout: 30000 });
|
|
99
|
+
} catch (reloadErr) {
|
|
100
|
+
console.error(
|
|
101
|
+
` [登录检测] 页面刷新失败: ${reloadErr.message},跳过重试继续检测...`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
// 重试后仍无法判断,信任 Cookie
|
|
@@ -125,9 +131,16 @@ export async function safeCheckLogin(page) {
|
|
|
125
131
|
for (let round = 2; round <= SAFE_CHECK_ROUNDS; round++) {
|
|
126
132
|
await new Promise((r) => setTimeout(r, SAFE_CHECK_INTERVAL));
|
|
127
133
|
// 重新导航到 TikTok 页面,确保页面状态刷新
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
try {
|
|
135
|
+
await page.goto("https://www.tiktok.com", {
|
|
136
|
+
waitUntil: "domcontentloaded",
|
|
137
|
+
timeout: 30000,
|
|
138
|
+
});
|
|
139
|
+
} catch (gotoErr) {
|
|
140
|
+
console.error(
|
|
141
|
+
`[安全登录检测] 第 ${round} 轮: 页面导航失败: ${gotoErr.message},直接在当前页面检测...`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
131
144
|
loggedIn = await isLoggedIn(page);
|
|
132
145
|
if (loggedIn) {
|
|
133
146
|
console.error(`[安全登录检测] 第 ${round} 轮: 已登录 ✓`);
|