mirror of
https://github.com/textcortex/claude-code-sandbox.git
synced 2025-08-04 19:08:21 +00:00
Checkpoint
This commit is contained in:
parent
79f16cbea9
commit
a8cf80ba1d
1 changed files with 21 additions and 2 deletions
|
@ -284,12 +284,31 @@ export class WebUIServer {
|
|||
|
||||
async openInBrowser(url: string): Promise<void> {
|
||||
try {
|
||||
// Try the open module first
|
||||
const open = (await import('open')).default;
|
||||
await open(url);
|
||||
console.log(chalk.blue('✓ Opened browser'));
|
||||
return;
|
||||
} catch (error) {
|
||||
console.log(chalk.yellow('Could not open browser automatically'));
|
||||
console.log(chalk.yellow(`Please open ${url} in your browser`));
|
||||
// Fallback to platform-specific commands
|
||||
try {
|
||||
const { execSync } = require('child_process');
|
||||
const platform = process.platform;
|
||||
|
||||
if (platform === 'darwin') {
|
||||
execSync(`open "${url}"`, { stdio: 'ignore' });
|
||||
} else if (platform === 'win32') {
|
||||
execSync(`start "" "${url}"`, { stdio: 'ignore' });
|
||||
} else {
|
||||
// Linux/Unix
|
||||
execSync(`xdg-open "${url}" || firefox "${url}" || google-chrome "${url}"`, { stdio: 'ignore' });
|
||||
}
|
||||
console.log(chalk.blue('✓ Opened browser'));
|
||||
return;
|
||||
} catch (fallbackError) {
|
||||
console.log(chalk.yellow('Could not open browser automatically'));
|
||||
console.log(chalk.yellow(`Please open ${url} in your browser`));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue