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 {Controller, Get, Post} from '@nestjs/common';
import {AppService} from './app.service'; import {AppService} from './app.service';
import {XCookieAccountDto} from "./x-poster/dto/x-cookie-account.dto"; 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() @Controller()
export class AppController { export class AppController {
constructor( constructor(
private readonly appService: AppService, private readonly appService: AppService,
private readonly xBrowserService: XBrowserService, private readonly xPosterRouterService: XPosterRouterService,
) { ) {
} }
@Get() @Get()
getHello() { getHello() {
return this.xBrowserService.verifyCookie(); return this.xPosterRouterService.verifyCookie();
} }
@Post('/set-x-cookies') @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.waitForTimeout(2000 + (Math.random() + Math.random()) * 3000);
await page.mouse.wheel(0, rand(300, 500)); await page.mouse.wheel(0, rand(300, 500));
// Detect login/challenge screen // Detect login/challenge screen
if (page.url().includes('/login') || page.url().includes('/flow')) { if (page.url().includes('/home')) {
this.logger.error('Cookies is die, please get news'); this.logger.log('Cookies live');
return false; return true;
// return { // return {
// success: false, // success: false,
// error: 'Redirected to login', // error: 'Redirected to login',
+2 -3
View File
@@ -61,7 +61,7 @@ export class XPosterRouterService {
} }
async verifyCookie(): Promise<any> { async verifyCookie(): Promise<any> {
console.debug('==> Verify Cookie'); this.logger.debug('==> Verify Cookie');
// const isAlive = await this.cookieSvc.verifyCookie(); // const isAlive = await this.cookieSvc.verifyCookie();
const isAlive = await this.browserSvc.verifyCookie(); const isAlive = await this.browserSvc.verifyCookie();
if (!isAlive) { 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.notifyService.sendUrgentMessageToTele('❌Cookie đã hết hạn vui lòng cập nhập để sử dụng.')
} }
await this.xCacheService.setStateXCookiesIsSillALive(); await this.xCacheService.setStateXCookiesIsSillALive();
this.notifyService.sendMessageToTele('✅Verify cookie pass').catch((err) => { await this.notifyService.sendMessageToTele('✅Verify cookie pass')
});
return isAlive; return isAlive;
} }