fix(browser): support Windows Chrome detection (PR #439, thanks @mrdbstn)
This commit is contained in:
@@ -80,6 +80,7 @@
|
|||||||
- Status: add provider usage snapshots to `/status`, `clawdbot status --usage`, and the macOS menu bar.
|
- Status: add provider usage snapshots to `/status`, `clawdbot status --usage`, and the macOS menu bar.
|
||||||
- Build: fix macOS packaging QR smoke test for the bun-compiled relay. Thanks @dbhurley for PR #358.
|
- Build: fix macOS packaging QR smoke test for the bun-compiled relay. Thanks @dbhurley for PR #358.
|
||||||
- Browser: fix `browser snapshot`/`browser act` timeouts under Bun by patching Playwright’s CDP WebSocket selection. Thanks @azade-c for PR #307.
|
- Browser: fix `browser snapshot`/`browser act` timeouts under Bun by patching Playwright’s CDP WebSocket selection. Thanks @azade-c for PR #307.
|
||||||
|
- Browser: detect Chrome/Chromium installs on Windows for the browser tool. Thanks @mrdbstn for PR #439.
|
||||||
- Browser: add `--browser-profile` flag and honor profile in tabs routes + browser tool. Thanks @jamesgroat for PR #324.
|
- Browser: add `--browser-profile` flag and honor profile in tabs routes + browser tool. Thanks @jamesgroat for PR #324.
|
||||||
- Gmail: include tailscale command exit codes/output when hook setup fails (easier debugging).
|
- Gmail: include tailscale command exit codes/output when hook setup fails (easier debugging).
|
||||||
- Telegram: stop typing after tool results. Thanks @AbhisekBasu1 for PR #322.
|
- Telegram: stop typing after tool results. Thanks @AbhisekBasu1 for PR #322.
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ describe("browser chrome profile decoration", () => {
|
|||||||
|
|
||||||
describe("browser chrome helpers", () => {
|
describe("browser chrome helpers", () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
vi.unstubAllEnvs();
|
||||||
vi.unstubAllGlobals();
|
vi.unstubAllGlobals();
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
});
|
});
|
||||||
@@ -157,6 +158,7 @@ describe("browser chrome helpers", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("picks the first existing Chrome candidate on Windows", () => {
|
it("picks the first existing Chrome candidate on Windows", () => {
|
||||||
|
vi.stubEnv("LOCALAPPDATA", "C:\\Users\\Test\\AppData\\Local");
|
||||||
const exists = vi
|
const exists = vi
|
||||||
.spyOn(fs, "existsSync")
|
.spyOn(fs, "existsSync")
|
||||||
.mockImplementation((p) => String(p).includes("Chrome SxS"));
|
.mockImplementation((p) => String(p).includes("Chrome SxS"));
|
||||||
@@ -167,8 +169,7 @@ describe("browser chrome helpers", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("finds Chrome in Program Files on Windows", () => {
|
it("finds Chrome in Program Files on Windows", () => {
|
||||||
// Use path.join to match how the function builds paths (cross-platform)
|
const marker = path.win32.join("Program Files", "Google", "Chrome");
|
||||||
const marker = path.join("Program Files", "Google", "Chrome");
|
|
||||||
const exists = vi
|
const exists = vi
|
||||||
.spyOn(fs, "existsSync")
|
.spyOn(fs, "existsSync")
|
||||||
.mockImplementation((p) => String(p).includes(marker));
|
.mockImplementation((p) => String(p).includes(marker));
|
||||||
|
|||||||
@@ -109,57 +109,61 @@ export function findChromeExecutableWindows(): BrowserExecutable | null {
|
|||||||
const programFilesX86 =
|
const programFilesX86 =
|
||||||
process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
||||||
|
|
||||||
const candidates: Array<BrowserExecutable> = [
|
const joinWin = path.win32.join;
|
||||||
|
const candidates: Array<BrowserExecutable> = [];
|
||||||
|
|
||||||
|
if (localAppData) {
|
||||||
// Chrome Canary (user install)
|
// Chrome Canary (user install)
|
||||||
{
|
candidates.push({
|
||||||
kind: "canary",
|
kind: "canary",
|
||||||
path: path.join(
|
path: joinWin(
|
||||||
localAppData,
|
localAppData,
|
||||||
"Google",
|
"Google",
|
||||||
"Chrome SxS",
|
"Chrome SxS",
|
||||||
"Application",
|
"Application",
|
||||||
"chrome.exe",
|
"chrome.exe",
|
||||||
),
|
),
|
||||||
},
|
});
|
||||||
// Chromium (user install)
|
// Chromium (user install)
|
||||||
{
|
candidates.push({
|
||||||
kind: "chromium",
|
kind: "chromium",
|
||||||
path: path.join(localAppData, "Chromium", "Application", "chrome.exe"),
|
path: joinWin(localAppData, "Chromium", "Application", "chrome.exe"),
|
||||||
},
|
});
|
||||||
// Chrome (user install)
|
// Chrome (user install)
|
||||||
{
|
candidates.push({
|
||||||
kind: "chrome",
|
kind: "chrome",
|
||||||
path: path.join(
|
path: joinWin(
|
||||||
localAppData,
|
localAppData,
|
||||||
"Google",
|
"Google",
|
||||||
"Chrome",
|
"Chrome",
|
||||||
"Application",
|
"Application",
|
||||||
"chrome.exe",
|
"chrome.exe",
|
||||||
),
|
),
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Chrome (system install, 64-bit)
|
// Chrome (system install, 64-bit)
|
||||||
{
|
candidates.push({
|
||||||
kind: "chrome",
|
kind: "chrome",
|
||||||
path: path.join(
|
path: joinWin(
|
||||||
programFiles,
|
programFiles,
|
||||||
"Google",
|
"Google",
|
||||||
"Chrome",
|
"Chrome",
|
||||||
"Application",
|
"Application",
|
||||||
"chrome.exe",
|
"chrome.exe",
|
||||||
),
|
),
|
||||||
},
|
});
|
||||||
// Chrome (system install, 32-bit on 64-bit Windows)
|
// Chrome (system install, 32-bit on 64-bit Windows)
|
||||||
{
|
candidates.push({
|
||||||
kind: "chrome",
|
kind: "chrome",
|
||||||
path: path.join(
|
path: joinWin(
|
||||||
programFilesX86,
|
programFilesX86,
|
||||||
"Google",
|
"Google",
|
||||||
"Chrome",
|
"Chrome",
|
||||||
"Application",
|
"Application",
|
||||||
"chrome.exe",
|
"chrome.exe",
|
||||||
),
|
),
|
||||||
},
|
});
|
||||||
];
|
|
||||||
|
|
||||||
for (const candidate of candidates) {
|
for (const candidate of candidates) {
|
||||||
if (exists(candidate.path)) return candidate;
|
if (exists(candidate.path)) return candidate;
|
||||||
|
|||||||
Reference in New Issue
Block a user