This commit is contained in:
NAME
2026-05-23 16:24:11 +00:00
parent 574f0944fa
commit 9d2b9a1f90
+5 -3
View File
@@ -17,7 +17,8 @@ export class XPwService implements OnModuleDestroy {
async runWithProfile(targetUrl?: string): Promise<Page> { async runWithProfile(targetUrl?: string): Promise<Page> {
// 1. Định nghĩa đường dẫn lưu trữ Profile (nằm trong thư mục dự án) // 1. Định nghĩa đường dẫn lưu trữ Profile (nằm trong thư mục dự án)
const profilePath = path.resolve(__dirname, `../../x_profile_data/${process.env.X_USERNAME}`); const profilePath = path.resolve(__dirname, `../../x_profile_data/${process.env.X_USERNAME}`);
const width = _toNumber(process.env.BROWSER_WP_WIDTH || 1479);
const height = _toNumber(process.env.BROWSER_WP_HEIGHT || 795);
// 2. Cấu hình các tham số ẩn danh (Antidetect) // 2. Cấu hình các tham số ẩn danh (Antidetect)
const antidetectArgs = [ const antidetectArgs = [
'--disable-blink-features=AutomationControlled', '--disable-blink-features=AutomationControlled',
@@ -27,6 +28,7 @@ export class XPwService implements OnModuleDestroy {
'--no-default-browser-check', '--no-default-browser-check',
// '--disable-setuid-sandbox' // '--disable-setuid-sandbox'
`--user-agent=${process.env.BROWSER_USER_AGENT}`, `--user-agent=${process.env.BROWSER_USER_AGENT}`,
`--window-size=${width},${height}`
]; ];
@@ -43,8 +45,8 @@ export class XPwService implements OnModuleDestroy {
// ========================================== // ==========================================
chromiumSandbox: true, chromiumSandbox: true,
viewport: { viewport: {
width: _toNumber(process.env.BROWSER_WP_WIDTH || 1479), width: width,
height: _toNumber(process.env.BROWSER_WP_HEIGHT || 795), height: height,
} }
}); });
} }