Skip to content

Drop browser-process gate to support Edge and any Chromium browser (Closes #55) - #66

Open
gkd2323c wants to merge 2 commits into
nashsu:mainfrom
gkd2323c:edge-support
Open

Drop browser-process gate to support Edge and any Chromium browser (Closes #55)#66
gkd2323c wants to merge 2 commits into
nashsu:mainfrom
gkd2323c:edge-support

Conversation

@gkd2323c

@gkd2323c gkd2323c commented Aug 31, 2026

Copy link
Copy Markdown

Background

Issue #55 reports that browser-mode commands (bilibili / zhihu / twitter / etc.) refuse to work on Microsoft Edge, because is_chrome_running() only checks for chrome.exe and never recognizes msedge.exe. autocli doctor shows the extension is connected, yet commands still fail with "Chrome is not running". A second, related bug: even after the gate is gone, wake_chrome() hardcodes launching Google Chrome, so on a machine without/avoiding Chrome the daemon would still spawn Chrome when the extension needs waking.

Changes in this PR

1. Remove the browser-process detection gate

  • Deletes is_chrome_running() and its call site in connect_daemon_page
  • The connection flow proceeds straight to the daemon handshake; whether a browser is usable is decided by the real daemon↔extension connection state, not by a guessed process name

2. Make wake_chrome() open the default browser, not Chrome

  • Windows: cmd /C start "" about:blank (empty title arg so about:blank is treated as a URL, not a program name)
  • macOS / Linux: open / xdg-open about:blank
  • No browser binary is hardcoded, so Edge/Brave/Arc/etc. are all woken correctly

Why this beats the allowlist approach

The original issue proposed adding msedge.exe (and macOS/Linux equivalents) inside is_chrome_running(). Removing the gate is more fundamental:

  • Universal: any Chromium browser with the extension installed (Chrome / Edge / Brave / Arc / Vivaldi / etc.) works out of the box, with no per-browser allowlist
  • Honest: when the extension is not connected it reports Chrome extension not connected instead of masquerading as Chrome is not running
  • Zero maintenance: no need to grow the process-name list as new browsers appear

Verification

  • cargo build --release passes
  • autocli doctor shows Chrome extension connected with only Edge running (no Chrome)
  • Browser-mode commands such as autocli zhihu hot fetch data end-to-end
  • Forced the wake path (restarted daemon to drop the extension connection): confirmed no chrome.exe process is spawned; the default browser (Edge) is used instead
  • Existing pure-API public commands (hackernews, etc.) are unaffected

Only crates/autocli-browser/src/bridge.rs is changed (two commits: gate removal + wake fix).

Closes #55

不再通过 is_chrome_running() 检测 chrome.exe / msedge.exe 进程名,
connect_daemon_page 直接进入 daemon 握手;浏览器是否可用由 daemon 与扩展
的真实连接状态决定,而非臆测的进程名。

对比 Issue nashsu#55 提议的"加 msedge 白名单"方案,本改动更彻底:
- 通用:任何装了扩展的 Chromium 浏览器(Chrome/Edge/Brave/Arc 等)直接可用
- 诚实:扩展未连时报 'Chrome extension not connected' 而非伪装成 'Chrome is not running'
- 零维护:无需随浏览器种类增长维护进程名清单

只改动 crates/autocli-browser/src/bridge.rs,删除 is_chrome_running 及其调用门卫。
@gkd2323c gkd2323c changed the title 移除浏览器进程门卫,支持 Edge 等任意 Chromium 浏览器(Closes #55) Drop browser-process gate to support Edge and any Chromium browser (Closes #55) Aug 31, 2026
wake_chrome() 在扩展 5s 未连上时触发,原实现硬编码拉起 Chrome
(macOS: open -a "Google Chrome";Windows: start chrome),会在未装/不
用 Chrome 的机器上误拉起 Chrome。

改为开系统默认浏览器:
- Windows: cmd /C start "" about:blank(空标题参数使 about:blank 被当 URL)
- macOS/Linux: open / xdg-open about:blank

这样 Edge/Brave/Arc 等任意默认 Chromium 浏览器都能被唤醒,且不绑定
具体浏览器二进制。与"移除 is_chrome_running 门卫"同一思路(PR nashsu#66)。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Microsoft Edge browser support

1 participant