mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
better tui
This commit is contained in:
@@ -384,6 +384,8 @@ async function launchChromium(options = {}) {
|
||||
return { success: false, error: 'Chrome binary not found' };
|
||||
}
|
||||
|
||||
const downloadsDir = getEnv('CHROME_DOWNLOADS_DIR');
|
||||
|
||||
// Kill zombies first
|
||||
if (killZombies) {
|
||||
killZombieChrome();
|
||||
@@ -412,6 +414,28 @@ async function launchChromium(options = {}) {
|
||||
console.error(`[!] Failed to remove SingletonLock: ${e.message}`);
|
||||
}
|
||||
}
|
||||
if (downloadsDir) {
|
||||
try {
|
||||
const defaultProfileDir = path.join(userDataDir, 'Default');
|
||||
const prefsPath = path.join(defaultProfileDir, 'Preferences');
|
||||
fs.mkdirSync(defaultProfileDir, { recursive: true });
|
||||
let prefs = {};
|
||||
if (fs.existsSync(prefsPath)) {
|
||||
try {
|
||||
prefs = JSON.parse(fs.readFileSync(prefsPath, 'utf-8'));
|
||||
} catch (e) {
|
||||
prefs = {};
|
||||
}
|
||||
}
|
||||
prefs.download = prefs.download || {};
|
||||
prefs.download.default_directory = downloadsDir;
|
||||
prefs.download.prompt_for_download = false;
|
||||
fs.writeFileSync(prefsPath, JSON.stringify(prefs));
|
||||
console.error(`[*] Set Chrome download directory: ${downloadsDir}`);
|
||||
} catch (e) {
|
||||
console.error(`[!] Failed to set Chrome download directory: ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find a free port
|
||||
@@ -455,6 +479,11 @@ async function launchChromium(options = {}) {
|
||||
// Dynamic args come after base so they can override if needed
|
||||
const chromiumArgs = [...baseArgs, ...dynamicArgs, ...extraArgs];
|
||||
|
||||
// Ensure keychain prompts are disabled on macOS
|
||||
if (!chromiumArgs.includes('--use-mock-keychain')) {
|
||||
chromiumArgs.push('--use-mock-keychain');
|
||||
}
|
||||
|
||||
// Add extension loading flags
|
||||
if (extensionPaths.length > 0) {
|
||||
const extPathsArg = extensionPaths.join(',');
|
||||
|
||||
Reference in New Issue
Block a user