Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

2 changed files with 3 additions and 15 deletions

2
.env
View File

@ -1,4 +1,4 @@
PORT=3456
HEADLESS=true
HEADLESS=false
# CHROME_PATH=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
API_KEY=

View File

@ -40,21 +40,14 @@ class BrowserManager {
console.log(`[${this._tag}] Sử dụng: ${chromePath || 'bundled Chromium'}`);
console.log(`[${this._tag}] Profile : ${this.profileDir}`);
const isHeadless = process.env.HEADLESS === 'true';
// NotebookLM ẩn cột Sources khi cửa sổ quá hẹp — cần viewport rộng
const WIN_W = parseInt(process.env.WINDOW_WIDTH || '1920', 10);
const WIN_H = parseInt(process.env.WINDOW_HEIGHT || '1080', 10);
const opts = {
headless: isHeadless,
headless: process.env.HEADLESS === 'true',
userDataDir: this.profileDir,
// headless=true: --start-maximized không có tác dụng, phải set viewport tường minh
defaultViewport: isHeadless ? { width: WIN_W, height: WIN_H } : null,
defaultViewport: null,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-infobars',
`--window-size=${WIN_W},${WIN_H}`,
'--start-maximized',
'--no-default-browser-check',
'--no-first-run',
@ -83,11 +76,6 @@ class BrowserManager {
this.page = null;
});
// Đảm bảo viewport đủ rộng (headless không auto-maximize)
if (isHeadless) {
await this.page.setViewport({ width: WIN_W, height: WIN_H });
}
// macOS: kéo cửa sổ lên trước (chỉ slot 0)
if (process.platform === 'darwin' && this.slotIndex === 0) {
setTimeout(() => {