Update
This commit is contained in:
@@ -17,7 +17,8 @@ export class XPwService implements OnModuleDestroy {
|
||||
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)
|
||||
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)
|
||||
const antidetectArgs = [
|
||||
'--disable-blink-features=AutomationControlled',
|
||||
@@ -27,6 +28,7 @@ export class XPwService implements OnModuleDestroy {
|
||||
'--no-default-browser-check',
|
||||
// '--disable-setuid-sandbox'
|
||||
`--user-agent=${process.env.BROWSER_USER_AGENT}`,
|
||||
`--window-size=${width},${height}`
|
||||
|
||||
];
|
||||
|
||||
@@ -43,8 +45,8 @@ export class XPwService implements OnModuleDestroy {
|
||||
// ==========================================
|
||||
chromiumSandbox: true,
|
||||
viewport: {
|
||||
width: _toNumber(process.env.BROWSER_WP_WIDTH || 1479),
|
||||
height: _toNumber(process.env.BROWSER_WP_HEIGHT || 795),
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user