This commit is contained in:
NAME
2026-05-12 09:14:12 +00:00
parent 8a7df08b6a
commit 62a01a118b
+9 -1
View File
@@ -143,6 +143,8 @@ export class XBrowserService implements OnModuleInit, OnModuleDestroy {
async verifyCookie() {
const page = await this.newPage();
try {
await page.goto('https://x.com/', {
waitUntil: 'domcontentloaded',
timeout: 30_000,
@@ -166,8 +168,14 @@ export class XBrowserService implements OnModuleInit, OnModuleDestroy {
.catch(() => false);
this.logger.log(`🔐 Session restore: ${isLoggedIn ? 'LOGGED IN' : 'GUEST (cookie có thể expired)'}`);
await page.close();
// await page.close();
return isLoggedIn;
} catch (er) {
this.logger.error(`Browser verify cookie fail: ${er.message}`);
return false;
} finally {
await page?.close().catch(() => null);
}
}
async postTweet(