D
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user