diff --git a/src/resources/extensions/browser-tools/index.ts b/src/resources/extensions/browser-tools/index.ts index c545360db..59f407f0d 100644 --- a/src/resources/extensions/browser-tools/index.ts +++ b/src/resources/extensions/browser-tools/index.ts @@ -343,7 +343,10 @@ async function ensureBrowser(): Promise<{ browser: Browser; context: BrowserCont // Lazy import so playwright is only loaded when actually needed const { chromium } = await import("playwright"); - browser = await chromium.launch({ headless: false }); + const launchOptions: Record = { headless: false }; + const customPath = process.env.BROWSER_PATH; + if (customPath) launchOptions.executablePath = customPath; + browser = await chromium.launch(launchOptions); context = await browser.newContext({ deviceScaleFactor: 2, viewport: { width: 1280, height: 800 }, diff --git a/src/wizard.ts b/src/wizard.ts index a41fe6e57..3706f5cae 100644 --- a/src/wizard.ts +++ b/src/wizard.ts @@ -26,6 +26,17 @@ async function promptMasked(label: string, hint: string): Promise { process.stdin.resume() process.stdin.setEncoding('utf8') let value = '' + const redraw = () => { + process.stdout.clearLine(0) + process.stdout.cursorTo(0) + if (value.length === 0) { + process.stdout.write(' ') + } else { + const dots = '●'.repeat(Math.min(value.length, 24)) + const counter = value.length > 24 ? ` ${dim}(${value.length})${reset}` : ` ${dim}${value.length}${reset}` + process.stdout.write(` ${dots}${counter}`) + } + } const handler = (ch: string) => { if (ch === '\r' || ch === '\n') { process.stdin.setRawMode(false) @@ -37,16 +48,14 @@ async function promptMasked(label: string, hint: string): Promise { process.stdin.setRawMode(false) process.stdout.write('\n') process.exit(0) - } else if (ch === '\u007f') { + } else if (ch === '\u007f' || ch === '\b') { if (value.length > 0) { value = value.slice(0, -1) } - process.stdout.clearLine(0) - process.stdout.cursorTo(0) - process.stdout.write(' ' + '*'.repeat(value.length)) + redraw() } else { value += ch - process.stdout.write('*') + redraw() } } process.stdin.on('data', handler)