Add Chrome browser support and configurable default browser - #1
Conversation
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
|
/codesmith review |
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
I reviewed the PR and found one real bug, which I fixed and pushed ( FindingsBug (fixed): Fixed both to a hoist-safe form that genuinely prefers const browser = globalThis.browser || globalThis.chrome; // background.js
var browser = globalThis.browser || globalThis.chrome; // content.js (inside IIFE)Confirmed: Firefox (both globals present) resolves to Other notes (not blocking, no change made)
Everything else (Chromium adapter, native-messaging |
* Add Chrome browser support and configurable default browser Co-authored-by: fenjastical <fenjastical@users.noreply.github.com> * Bump version to 2.1.0 Co-authored-by: fenjastical <fenjastical@users.noreply.github.com> * Fix browser/chrome shim to prefer browser API in Firefox Co-authored-by: fenjastical <fenjastical@users.noreply.github.com> --------- Co-authored-by: fenjastical <fenjastical@users.noreply.github.com>
Adds Chrome as a first-class browser alongside Zen, and lets you pick the browser used when
--browseris omitted viaconfig browser <browser>.Chrome support
Chrome joins the adapter registry through a new Chromium-family adapter, mirroring the existing Firefox-family design. The native bridge (
native-host.cjs) is already browser-agnostic, so the Chromium adapter reuses it and only differs where Chromium genuinely differs from Firefox:allowed_origins(chrome-extension://<id>/) instead of Firefox'sallowed_extensions, and is written into Chrome'sNativeMessagingHostsdirectory (plus theHKCU\Software\Google\Chrome\NativeMessagingHostsregistry key on Windows).install chromestages an unpacked extension under~/OpenBrowser/extensions/chrome/for "Load unpacked".To make the native-messaging
allowed_originsdeterministic, the built Chromium manifest ships a fixed publickey, so the unpacked extension always loads with the same extension id. A test recomputes the id from the key to guard the constant.Shared native-host / process-detection helpers were extracted from
firefox-family.jsintobrowsers/shared.jsso both families reuse them without duplication (Zen install is unchanged).The build now emits an MV3 Chromium artifact (
dist/extensions/chromium/) from the same extension source; the two extension scripts got a tiny, feature-detected compatibility layer so one source runs on both families:Configurable default browser
config browser <browser>persists a default to~/OpenBrowser/config.json. Resolution order is--browserflag, then the configured default, then Zen.Validation
npm test(17 tests incl. new config + Chrome adapter coverage),npm run build, andweb-ext linton the Firefox source all pass in the sandbox.install zen(regression) andinstall chromeend to end: native host launcher, native-messaging manifest, and staged extension all land correctly.Note: the Chrome extension runtime could not be exercised against a live Chrome in CI (no browser available). The CLI, adapter, native-messaging, config, and build layers are unit-tested; loading the unpacked extension in a real Chrome is the remaining manual check.
Summary by cubic
Adds Chrome as a first-class browser alongside Zen and introduces a default-browser setting so commands can run without passing
--browser. Also unifies the extension code across Firefox and Chromium with a shim that prefers thebrowserAPI and falls back tochrome.New Features
~/OpenBrowser/extensions/chrome/with a stable ID.browserwith achromefallback and detect MV2/MV3. Screenshot usescaptureVisibleTabwhen per-tab capture isn’t available.config browser <browser>persists a default in~/OpenBrowser/config.json; CLI resolves--browser, then the configured default, then Zen.npm run buildnow builds both families; addedbuild:chromium. Version bumped to 2.1.0 across package and manifests.Migration
install chrome, then inchrome://extensionsenable Developer mode and “Load unpacked” from~/OpenBrowser/extensions/chrome/.OpenBrowser config browser chrometo omit--browser.Written for commit c26da99. Summary will update on new commits.