feat: add cross-browser builds and refresh project documentation

- add Chrome/Chromium Manifest V3 build with PAC proxy routing
- keep Firefox Manifest V2 and Android compatibility
- add Chromium API adapter and service worker
- add Chrome build script and Makefile target
- update README and add AGENT.md
- document installation, signing, permissions, themes, and platform
  limitations
This commit is contained in:
wt committed 2026-10-09 16:17:33 +07:00
1 parent 11508e6740
commit d0c5fc5679
12 files changed
+256 -14

No files matched your search

+20 -3
View File
@@ -13,10 +13,11 @@ Proxy Switcher is a Firefox WebExtension that routes requests for selected domai
- Choose a **System**, **Light**, or **Dark** theme in Advanced Settings.
- Use the same theme in the options page and popup.
- Run on Firefox desktop and Firefox Android versions that support the declared minimum version.
- Build a separate Manifest V3 package for Chrome and Chromium-based desktop browsers.
## How it works
The background script listens to `browser.proxy.onRequest`. It extracts the request's origin domain and returns the matching proxy configuration. Domains without a configuration, and configured domains whose `enabled` value is `false`, use a direct connection. Proxy authentication is supplied only when the matching domain has credentials.
On Firefox, the background script listens to `browser.proxy.onRequest`. On Chrome and Chromium, the background service worker generates a PAC script through `chrome.proxy.settings`. Both implementations extract the request host and route only enabled matching domains; all other domains use a direct connection. Proxy authentication is supplied only when the matching domain has credentials.
The extension does not collect browsing history or send configuration to a server. Domain entries, profiles, theme selection, and credentials are saved with `browser.storage.local`. The extension does not implement an additional encryption layer, so protect the Firefox profile and device that contain the data.
@@ -47,7 +48,7 @@ The manifest requests these permissions:
- `webRequest` and `webRequestBlocking` — provide proxy authentication credentials.
- `<all_urls>` — apply the domain routing policy to web requests.
These permissions are used for proxy management. The manifest declares `data_collection_permissions.required` as `none`.
These permissions are used for proxy management. The extension does not collect or transmit data.
## Installation
@@ -65,7 +66,21 @@ For a normal install, use an XPI signed by Mozilla/AMO. Firefox may reject an un
Firefox Android requires a signed extension package. Submit the build through [addons.mozilla.org/developers](https://addons.mozilla.org/developers/) and download the signed XPI after review, or follow Mozilla's [self-distributed extension instructions](https://extensionworkshop.com/documentation/publish/install-self-distributed/). The manifest includes `browser_specific_settings.gecko_android` so AMO can mark the extension as Android-compatible.
The `proxy.onRequest` API is supported on Firefox Android, but the extension still needs to be tested on the target Firefox version and device.
The manifest targets Firefox Android 113 or newer. The `proxy.onRequest` API is supported there, but the extension still needs to be tested on the target Firefox version and device.
### Chrome and Chromium desktop
Chrome and Chromium do not use the Firefox proxy API, so the project includes a separate Manifest V3 package. It works on desktop Chrome, Chromium, Edge, Brave, Opera, and other Chromium browsers that expose the `chrome.proxy` API. Chrome Android and Chrome iOS do not support installing ordinary extensions; this project cannot enable extensions on those platforms.
Build and install the unpacked package:
```sh
make build-chrome
```
Then open `chrome://extensions` (or the equivalent page), enable **Developer mode**, and select **Load unpacked** using a directory containing the Chrome build. The ZIP at `web-ext-artifacts/proxyswitcherforkbywt-chrome.zip` can be uploaded to the Chrome Web Store or unpacked for local testing.
The Chrome build uses a PAC script because Chrome's proxy API is global rather than Firefox's per-request `proxy.onRequest` API. Changing a proxy configuration regenerates that PAC script. Chrome proxy credentials are provided through `webRequest.onAuthRequired`.
## Build
@@ -77,6 +92,8 @@ make build
The package is created at `web-ext-artifacts/proxyswitcherforkbywt.xpi`. This local build is not an AMO signature. After changing any file, rebuild and sign again; do not reuse old `META-INF` signature files.
For Chrome/Chromium, run `make build-chrome`. That creates `web-ext-artifacts/proxyswitcherforkbywt-chrome.zip` from `manifest.chrome.json` and the shared UI files.
To remove generated packages:
```sh