This commit is contained in:
NAME
2026-05-13 02:30:00 +00:00
parent b4be37fbe7
commit 10d61d59be
3 changed files with 8 additions and 9 deletions
+3 -3
View File
@@ -1,19 +1,19 @@
import {Controller, Get, Post} from '@nestjs/common';
import {AppService} from './app.service';
import {XCookieAccountDto} from "./x-poster/dto/x-cookie-account.dto";
import {XBrowserService} from "./x-poster/x-browser.service";
import {XPosterRouterService} from "./x-poster/x-poster.router.service";
@Controller()
export class AppController {
constructor(
private readonly appService: AppService,
private readonly xBrowserService: XBrowserService,
private readonly xPosterRouterService: XPosterRouterService,
) {
}
@Get()
getHello() {
return this.xBrowserService.verifyCookie();
return this.xPosterRouterService.verifyCookie();
}
@Post('/set-x-cookies')
+3 -3
View File
@@ -152,9 +152,9 @@ export class XBrowserService implements OnModuleInit, OnModuleDestroy {
await page.waitForTimeout(2000 + (Math.random() + Math.random()) * 3000);
await page.mouse.wheel(0, rand(300, 500));
// Detect login/challenge screen
if (page.url().includes('/login') || page.url().includes('/flow')) {
this.logger.error('Cookies is die, please get news');
return false;
if (page.url().includes('/home')) {
this.logger.log('Cookies live');
return true;
// return {
// success: false,
// error: 'Redirected to login',
+2 -3
View File
@@ -61,7 +61,7 @@ export class XPosterRouterService {
}
async verifyCookie(): Promise<any> {
console.debug('==> Verify Cookie');
this.logger.debug('==> Verify Cookie');
// const isAlive = await this.cookieSvc.verifyCookie();
const isAlive = await this.browserSvc.verifyCookie();
if (!isAlive) {
@@ -69,8 +69,7 @@ export class XPosterRouterService {
await this.notifyService.sendUrgentMessageToTele('❌Cookie đã hết hạn vui lòng cập nhập để sử dụng.')
}
await this.xCacheService.setStateXCookiesIsSillALive();
this.notifyService.sendMessageToTele('✅Verify cookie pass').catch((err) => {
});
await this.notifyService.sendMessageToTele('✅Verify cookie pass')
return isAlive;
}